CS50x 2024 - Lecture 9 - Flask

Поділитися
Вставка
  • Опубліковано 1 чер 2024
  • ***
    This is CS50, Harvard University's introduction to the intellectual enterprises of computer science and the art of programming.
    ***
    TABLE OF CONTENTS
    00:00:00 - Introduction
    00:01:01 - Flask
    00:27:53 - Forms
    00:33:10 - Templates
    00:40:36 - Request Methods
    00:54:00 - Frosh IMs
    01:31:37 - SQLite and Python
    01:40:07 - Cookies and Sessions
    01:58:33 - Shopping Cart
    02:08:30 - Shows
    02:18:54 - APIs
    ***
    HOW TO SUBSCRIBE
    ua-cam.com/users/subscription_c...
    HOW TO TAKE CS50
    edX: cs50.edx.org/
    Harvard Extension School: cs50.harvard.edu/extension
    Harvard Summer School: cs50.harvard.edu/summer
    OpenCourseWare: cs50.harvard.edu/x
    HOW TO JOIN CS50 COMMUNITIES
    Discord: / discord
    Ed: cs50.harvard.edu/x/ed
    Facebook Group: / cs50
    Faceboook Page: / cs50
    GitHub: github.com/cs50
    Gitter: gitter.im/cs50/x
    Instagram: / cs50
    LinkedIn Group: / 7437240
    LinkedIn Page: / cs50
    Medium: / cs50
    Quora: www.quora.com/topic/CS50
    Reddit: / cs50
    Slack: cs50.edx.org/slack
    Snapchat: / cs50
    SoundCloud: / cs50
    Stack Exchange: cs50.stackexchange.com/
    TikTok: / cs50
    Twitter: / cs50
    UA-cam: / cs50
    HOW TO FOLLOW DAVID J. MALAN
    Facebook: / dmalan
    GitHub: github.com/dmalan
    Instagram: / davidjmalan
    LinkedIn: / malan
    Quora: www.quora.com/profile/David-J...
    TikTok: / davidjmalan
    Twitter: / davidjmalan
    ***
    CS50 SHOP
    cs50.harvardshop.com/
    ***
    LICENSE
    CC BY-NC-SA 4.0
    Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
    creativecommons.org/licenses/...
    David J. Malan
    cs.harvard.edu/malan
    malan@harvard.edu

КОМЕНТАРІ • 76

  • @Damonbodine
    @Damonbodine 3 місяці тому +43

    Seeing David use the duck made me realize I’m not alone. Such a real moment Love this course so much.

  • @stepanrusinko2456
    @stepanrusinko2456 4 місяці тому +45

    This is the big reckoning, so much is connecting together. My head hurts but I am not giving up this far.

    • @lpdemodimi
      @lpdemodimi 3 місяці тому +3

      This is the way.

    • @FlowersByIrene
      @FlowersByIrene 3 місяці тому +2

      I just looked at Problem Set 9 Finance and it truly does all come together. Quite overwhelming

    • @boundlesstraveller
      @boundlesstraveller 2 місяці тому

      Keep it up and enjoy every minute of it...❤

  • @UnboxRacing
    @UnboxRacing 3 дні тому

    "Let me go ahead and PROPOSE that...." Bingo! Classic David. I wish we had Profs like DM when I was at school.

  • @dwkeirstead
    @dwkeirstead 3 місяці тому +12

    The moment with the DDB was hands down my favorite moment so far in these lectures. So relatable and David’s reaction was honestly adorable 😅 so he is human too…

  • @lpdemodimi
    @lpdemodimi 3 місяці тому +10

    ok this really fried my brain. Thank you for the efforts, will need to let that sink in.

  • @faizanahmed9304
    @faizanahmed9304 5 місяців тому +10

    Thank you team @CS50

  • @teaganp5011
    @teaganp5011 10 днів тому

    I’m really thankful for this class. It really feels like I am part of the class and that duck debugger moment get so relatable

  • @arnabmandal1377
    @arnabmandal1377 Місяць тому

    This man is a legend and the best teacher that I found till now...
    Lots of love and respect to prof. David J. Malan and the entire team of CS50

  • @Piranha_Dark
    @Piranha_Dark 5 місяців тому +5

    Thanks once again for an amazing and helpful content. Cheers to 2024 🎉

  • @MarkBetterDev
    @MarkBetterDev 4 місяці тому +53

    after every lecture i watch, i tend to think to myself how i would've coped if i was a complete beginner. even with a year of coding, this course is hard

    • @prcvl
      @prcvl 4 місяці тому +5

      this course is really easy

    • @berkeumutsahinturk921
      @berkeumutsahinturk921 4 місяці тому

      just no@@prcvl

    • @harshpalsinhzala1092
      @harshpalsinhzala1092 4 місяці тому +7

      I was a complete beginner when I took this course 2 years ago. I don't think it's that hard. In fact because of it, I fell in love with Computer science and now I'm half way through my degree.😊

    • @elokthewizard
      @elokthewizard 2 місяці тому +10

      @@prcvlthis was a productive and positive comment. this is the kind of comment that makes people value your input and become your friend.

    • @elokthewizard
      @elokthewizard 2 місяці тому +1

      i came from the odin project - the insight this course provides is the difference between blind flailing and planned execution

  • @Aman-fz1ew
    @Aman-fz1ew 3 місяці тому +5

    Awesone Video . Simultaneously coding helps to understand the concept

  • @UnboxRacing
    @UnboxRacing 3 дні тому

    If you are following this at home your won't have access to the same environment as David. Advisable to create virtual environment in 'hello' and run flask that way. Django would have been nice but DM's teaching is world class.

  • @alainrouleau
    @alainrouleau 11 днів тому

    6:36 This is actually a very good definition for a so-called "framework" that I never really thought about before. It's not just third-party code. But it's third-party conventions as well.
    Which means you may have to learn a whole new syntax, etc.

  • @MazineZ
    @MazineZ 3 місяці тому +6

    Every lesson fulfills my brain with so much information and this is no exception.

  • @johnpasir3207
    @johnpasir3207 3 місяці тому

    great class... definitely not for beginning beginners but more for advanced beginners

  • @bastionbet3809
    @bastionbet3809 22 дні тому

    Почему так много людей пишет, что курс сложный?!) Я программирую пару месяцев и этот курс выглядит максимально понятным и доступным для всех!

  • @alainrouleau
    @alainrouleau 11 днів тому

    Using the CS50 duck was nice...
    But I'm surprised I haven't seen more use of the built-in help function? I don't think it's even been mentioned once? Could be wrong though.
    Very easy to use, for example, in the terminal just use >>> help(print) at the prompt. Will tell you everything you need to know about the print function and all its parameters. Same thing for any other object such as a class, function/method, module, list, dict, str, int, etc.
    Plus, there's code completion in VS Code or simple dot notation with documentation pop-ups. Has all of that been disabled?
    Knowing how to access and read documentation is a skill every developer or programmer needs to know.

  • @mr_DIY
    @mr_DIY 4 місяці тому +2

    That’s the lecture here. A lot but interesting ❤

  • @BarronMartinez-tz1up
    @BarronMartinez-tz1up 28 днів тому

    Coming here to prep for my interview next week for django web dev. I know im gonna learn alot and be entertained.

  • @-.lucas.vieira.-
    @-.lucas.vieira.- 4 дні тому

    If something like "this is a lot to process" hits you after watching the lecture, I can say, assertively, you are not alone.

  • @velezmusic4350
    @velezmusic4350 Місяць тому

    It was nice to see the maestro get flustered but gracefully demo his googling / prompting. That hunch and deep breath was not giving staged 😂

  • @alex.triflesclear5827
    @alex.triflesclear5827 4 місяці тому

    Finally got here, thanks god!

  • @CodingByAmp
    @CodingByAmp 2 місяці тому +1

    love cs50 flask

  • @Alexander-iq5yq
    @Alexander-iq5yq 3 місяці тому +7

    Something weird happens at 50:27

  • @viniciusalencardev
    @viniciusalencardev 4 місяці тому

    very great

  • @mikael5914
    @mikael5914 Місяць тому +1

    Excellent course quality aside. Is anyone else obsessed with the soundtrack (intro)?

  • @RomarioKurti28
    @RomarioKurti28 3 місяці тому +2

    Profesor is hilarious 😂

  • @yihong
    @yihong 19 днів тому

    Thank you.

  • @grindinguy
    @grindinguy 3 місяці тому +2

    hardest part of the all lecture imo

  • @caiofernando
    @caiofernando 4 дні тому

    I have a question about the last bit of this lecture.
    Since he got rid of the template search.html and just returned the jsonified list of shows, at what point does the json file get iterated over and converted into a list with the titles of the movies? I'm assuming version 3 of shows has an extra piece of code at index.html that does that, right?

  • @not_amanullah
    @not_amanullah 2 місяці тому

    This is helpful ❤

  • @ridabrahim7604
    @ridabrahim7604 2 місяці тому +4

    i faced some trouble with the cart app, the session["cart"] is that holds the list containing the id's of books added to the cart isn't working, after debugging and printing the values i always find myself passing an empty list to the cart.html, i tried to figure what's going on and found out that the Sqlite command to books = db.execute("SELECT * FROM books WHERE id IN (?)", session["cart"]) didn't want to work, it seems that the syntax somehow wrong and even chatgpt told me that maybe sqlite is expecting multiple "?" to process the list and not only one "?" to use the list, but for professor David it's working fine, note: i didn't implement the logic manually i literally downloaded the file src9, any idea guys ?

    • @ridabrahim7604
      @ridabrahim7604 2 місяці тому +1

      i found the solution, i will post it here if someone got stuck with this problem, after debugging and adding another list of my own, like this : if book_id:
      session["cart"].append(book_id)
      list_test.append(book_id) , i noticed that session["cart"] didn't add all the id's appended to it but list_test had all the values in it, so it was a problem of consistency from session["cart"], the solution after explaining the issue to duck debugger was to add this line : session.modified = True | after appending to the session["cart"] , it seems that this line just tells flask that the session got some new changes. i'm using flask on my local machine and running the server on my windows not codespace so probably that's the issue.

    • @jeerasakchanprasertkul3856
      @jeerasakchanprasertkul3856 2 місяці тому +1

      I faced the same problem. Another way to solve it is to change this line of code from:
      session["cart"].append(book_id)
      to:
      cart = session["cart"]
      cart.append(book_id)
      session["cart"] = cart
      It's not the best solution, but it works

  • @ptd3v
    @ptd3v 2 місяці тому +1

    I got a little lost in this episode, I think it was the Jinja stuff. The duck saving the day was amazing.

  • @Svish_
    @Svish_ 10 днів тому

    Really wish you would've introduced the label tag, instead of using the placeholder-attribute, which is kind of terrible for multiple UX and accessibility reasons 😟

  • @Nikita_Code
    @Nikita_Code Місяць тому +4

    in my virtual workplace " flask run" give me an error in a web page 🙄

  • @noaydev
    @noaydev 2 місяці тому

    I'm going to make it 🔥🔥🔥🔥🔥

  • @Herzhoz
    @Herzhoz 2 місяці тому

    This was the last one? great content, btw

  • @user-py3rs1eq7m
    @user-py3rs1eq7m 5 місяців тому +3

    4th comment? also thanks cs50, amazing course from which I have learned a lot

  • @not_amanullah
    @not_amanullah 3 місяці тому +1

    Understood++

  • @RomarioKurti28
    @RomarioKurti28 3 місяці тому +1

    My last week 🎉🎉🎉🎉😂

  • @mallickpriyanshu
    @mallickpriyanshu 2 місяці тому +1

    I love the moment of David with DDB 😂 He was honest and adorable and It's what all devs do when they get stuck 😂

  • @RomarioKurti28
    @RomarioKurti28 3 місяці тому

    How come in the shows part, the html placeholder is {{show}} while in the app.py file the variable is show(singular) and it still works?

    • @tjejenathina3829
      @tjejenathina3829 2 місяці тому

      Unless I'm mistaken, it's because Flask uses Jinja as a template engine. Jinjas syntax uses double brackets while python only singular. But double check the jinja documentation so im not lying to you lol

  • @xiuzhenyang8047
    @xiuzhenyang8047 11 днів тому

    Anyone know how to open a terminal after I accidentally close all the terminal?

  • @danon3170
    @danon3170 29 днів тому

    Привет из Ленинградского государственного университета 🤙

  • @hemelhasan348
    @hemelhasan348 19 днів тому

    2:05:35 not working for me. Any solution!

  • @user-nk6uv8ce7t
    @user-nk6uv8ce7t 4 місяці тому +3

    这个教程真的很牛逼

  • @Dpk_YT
    @Dpk_YT 4 місяці тому

    ❤❤

  • @jazzyniko
    @jazzyniko 2 місяці тому

    app = Flask(__name__) Is this calling a function or creating an object from the class Flask? Can someone explain this, please? (on minute 12:22 more or less)

    • @jazzyniko
      @jazzyniko 2 місяці тому +1

      Ok I found this so now I understand that better:
      In Python, classes can be callable, which means they can behave like functions when called. When you use Flask() in Flask, you're actually calling the Flask class, which acts as a constructor function to create a new instance of the Flask application. So, to clarify, Flask() is both a class and a function. It's a class because it defines the blueprint for Flask applications, and it's a function because you use it to instantiate objects of that class.

  • @GucciJohanne
    @GucciJohanne Місяць тому

    had to watch this at 0.9 speed LOL 😅

  • @aopen130
    @aopen130 Місяць тому

    01:22:00 wow. I can estimate the amount of sweat drip down his back while his code is not working in front of hundred of students.😅

  • @danilbanan406
    @danilbanan406 4 місяці тому +2

    Why they using flask ? Why not FastApi

    • @hiramarturooliveromuoz3728
      @hiramarturooliveromuoz3728 3 місяці тому

      Flask is better

    • @user-bt8ui8kl7q
      @user-bt8ui8kl7q Місяць тому +1

      Flask is simpler for students to understand as many of us are beginners who are taking CS50 as their first course.

    • @bekay7663
      @bekay7663 Місяць тому

      It's always strange when people act like they know more then the teacher. The entire course curated the way it is for a reason.

  • @SkepticLens
    @SkepticLens 5 місяців тому

    2nd comment?

  • @FernandoMees
    @FernandoMees Місяць тому +1

    What a good duck. 😄
    But... CS50's staff is smarter than this. I'm sure it was all made up just to show the AI off. 😂