CS50x 2024 - Lecture 9 - Flask

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 136

  • @Damonbodine
    @Damonbodine 9 месяцев назад +145

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

    • @ProgrammerPenguin
      @ProgrammerPenguin 4 месяца назад +3

      when does he do that?

    • @lintz_lin
      @lintz_lin 4 месяца назад +5

      @@ProgrammerPenguin 1:22:42

    • @ProgrammerPenguin
      @ProgrammerPenguin 4 месяца назад +4

      @@lintz_lin thanks for replying so quickly and also that's funny as hell.

    • @tensevo
      @tensevo Месяц назад +1

      I know right, students need to see you are both godlike and with human flaw, for them to be inspired.

  • @dwkeirstead
    @dwkeirstead 9 месяцев назад +46

    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…

  • @stepanrusinko2456
    @stepanrusinko2456 10 месяцев назад +91

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

    • @lpdemodimi
      @lpdemodimi 9 месяцев назад +4

      This is the way.

    • @FlowersByIrene
      @FlowersByIrene 9 месяцев назад +2

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

    • @boundlesstraveller
      @boundlesstraveller 8 месяцев назад

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

  • @johnpasir3207
    @johnpasir3207 9 месяцев назад +12

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

    • @meera.srivastava
      @meera.srivastava 4 месяца назад +4

      i was an absolute beginner when i started cs50 and i think that if you care about the subject and are willing to put in the time and effort, then you can do it! it’s bound to be hard, but just keep going yk?

  • @CarlosReyes-e3o
    @CarlosReyes-e3o Месяц назад +2

    At. 1:22:47 LOL. He is Human!!! I have never loved him more than at that moment! Thank you for what you do, David!

  • @duydangdroid
    @duydangdroid 4 месяца назад +16

    Duck >> Stack Overflow > glance at the audience for help

  • @-.lucas.vieira.-
    @-.lucas.vieira.- 6 месяцев назад +60

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

  • @arnab_x24
    @arnab_x24 7 месяцев назад +4

    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

  • @velezmusic4350
    @velezmusic4350 7 месяцев назад +7

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

  • @lionking2592
    @lionking2592 4 месяца назад +4

    🎉 completed. This is awesome intro for flask begginers. THANK YOU 🙏🙏

  • @MarkBetterDev
    @MarkBetterDev 10 месяцев назад +123

    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 10 месяцев назад +19

      this course is really easy

    • @berkeumutsahinturk921
      @berkeumutsahinturk921 10 месяцев назад

      just no@@prcvl

    • @harshpalsinhzala1092
      @harshpalsinhzala1092 10 месяцев назад +14

      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 7 месяцев назад +32

      @@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 7 месяцев назад +4

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

  • @fyardlest1
    @fyardlest1 3 месяца назад +7

    The real Flask course!

  • @UnboxRacing
    @UnboxRacing 5 месяцев назад +17

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

  • @TháiĐạt2012
    @TháiĐạt2012 2 месяца назад +2

    David is so good that even when he messes up, people still like it

  • @faizanahmed9304
    @faizanahmed9304 10 месяцев назад +12

    Thank you team @CS50

  • @lpdemodimi
    @lpdemodimi 9 месяцев назад +22

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

  • @teaganp5011
    @teaganp5011 6 месяцев назад +2

    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

  • @alainrouleau
    @alainrouleau 6 месяцев назад +7

    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.

  • @Piranha_Dark
    @Piranha_Dark 10 месяцев назад +6

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

  • @MazineZ
    @MazineZ 9 месяцев назад +7

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

  • @josephlevin
    @josephlevin 27 дней назад

    ~1:23:00 That was very rich. I admire David's humor and candor in that moment, and appreciate how I'd have done exactly as he did- Googling then Ducking for an answer!

  • @Aman-fz1ew
    @Aman-fz1ew 9 месяцев назад +8

    Awesone Video . Simultaneously coding helps to understand the concept

  • @mikael5914
    @mikael5914 7 месяцев назад +7

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

  • @CodingByAmp
    @CodingByAmp 8 месяцев назад +4

    love cs50 flask

  • @shawn14isme
    @shawn14isme Месяц назад +2

    Here i was thinking that i was doing crazy stuff with bootstrap last week.

  • @mr_DIY
    @mr_DIY 10 месяцев назад +4

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

  • @grindinguy
    @grindinguy 9 месяцев назад +6

    hardest part of the all lecture imo

  • @wrt3778
    @wrt3778 2 месяца назад

    So much energy! Thank you.

  • @bastionbet3809
    @bastionbet3809 6 месяцев назад

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

  • @GenZ_01_
    @GenZ_01_ 3 месяца назад

    Another high quality lecture🙏🏽

  • @ronaldogandra
    @ronaldogandra 2 месяца назад +1

    "RALLRIGHT, any other questions this far on this...?" some of David's phrases just stick in your head lol thanks for this course!!

  • @UnboxRacing
    @UnboxRacing 6 месяцев назад

    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.

  • @ptd3v
    @ptd3v 8 месяцев назад +1

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

  • @mallickpriyanshu
    @mallickpriyanshu 8 месяцев назад +2

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

  • @freelance-writer
    @freelance-writer 2 месяца назад +1

    1:22:40 Love it. 🦆

  • @SMD-kk8ud
    @SMD-kk8ud 3 месяца назад

    Just....Awesome!!

  • @s.baskaravishnu22
    @s.baskaravishnu22 6 дней назад

    Many thanks

  • @alainrouleau
    @alainrouleau 6 месяцев назад +1

    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.

  • @RomarioKurti28
    @RomarioKurti28 9 месяцев назад +2

    Profesor is hilarious 😂

  • @harshpareta-o6o
    @harshpareta-o6o 14 дней назад

    Cheers !

  • @Alexander-iq5yq
    @Alexander-iq5yq 9 месяцев назад +9

    Something weird happens at 50:27

    • @coreydubia2881
      @coreydubia2881 9 месяцев назад

      AI generated David!🤣

    • @jeannoelhonisch7037
      @jeannoelhonisch7037 4 месяца назад

      I knew he would be an alien or sum cause my teachers didn't teach as he does.

  • @alex.triflesclear5827
    @alex.triflesclear5827 10 месяцев назад

    Finally got here, thanks god!

  • @danon3170
    @danon3170 6 месяцев назад +2

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

  • @noaydev
    @noaydev 8 месяцев назад

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

  • @chrisjoyce4047
    @chrisjoyce4047 5 месяцев назад

    There are two problems with the code presented in the lecture in the froshims section. Firstly, David's code uses request.form.getall which does not work in the current CS50 ide. You need to use request.form.getlist instead. Secondly, "Ultimate Frisbee" gives an error when a loop is used to check the sports with {{sport}}. To make it work you need to use "{{sport}}" instead.

  • @not_amanullah
    @not_amanullah 7 месяцев назад

    This is helpful ❤

  • @luigi-b5m
    @luigi-b5m 6 месяцев назад

    Thank you.

  • @not_amanullah
    @not_amanullah 9 месяцев назад +1

    Understood++

  • @Herzhoz
    @Herzhoz 8 месяцев назад

    This was the last one? great content, btw

  • @ShivanshSanghvi
    @ShivanshSanghvi 10 месяцев назад +3

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

  • @rida_brahim
    @rida_brahim 8 месяцев назад +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 ?

    • @rida_brahim
      @rida_brahim 8 месяцев назад +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 8 месяцев назад +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

    • @tonyvenice5252
      @tonyvenice5252 Месяц назад

      Strangely, I had the same error and chat gpt gave me the same answer as "Flask only tracks changes if you reassign the modified list back to session["cart"]." but my error was writing :
      if cart not in session:
      instead of if "cart" not in session:
      Now it works like in the course

  • @chrisjoyce4047
    @chrisjoyce4047 5 месяцев назад +1

    Continuing the lecture I see he fixed the request.form.getlist problem, but the second problem remains.

  • @RomarioKurti28
    @RomarioKurti28 9 месяцев назад +1

    My last week 🎉🎉🎉🎉😂

  • @八玲珑
    @八玲珑 10 месяцев назад +3

    这个教程真的很牛逼

  • @arungjose1849
    @arungjose1849 2 месяца назад +1

    Can anyone please tell me why cs50 thought of teaching Flask rather than Django? Do more people use Django nowadays? Are there any frameworks better than flask and django, and was this just to teach the basics? Anyways, I really enjoyed the class

    • @LeelaSankharM
      @LeelaSankharM Месяц назад +2

      flask is a microframework and is simple than django. i think cs50 opted flask so that it doesnt overwhelm the students but teaches the fundamentals, get the job done. tbvh for me this was very intense, imagine how it would be for django. and also coming to frameworks which are better is a subjective topic ig!

  • @rafiullah-zz1lf
    @rafiullah-zz1lf 5 месяцев назад

    🎉🎉🎉🎉 feeling happy finally got finance done and got 21 /21. Thanks @david J.Malan

  • @swampguy277
    @swampguy277 4 месяца назад

    the DDB moment was so damn funny hahah

  • @Svish_
    @Svish_ 6 месяцев назад

    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 😟

  • @viniciusalencardev
    @viniciusalencardev 10 месяцев назад

    very great

  • @thetasworld
    @thetasworld 5 месяцев назад +2

    And I thought week 8 was tough...good lord.

    • @matei8327
      @matei8327 5 месяцев назад

      Its hard, Its useful to make projects and use every new thing that you learn in this week. Practice everythig ;)

  • @caiofernando
    @caiofernando 6 месяцев назад +2

    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?

    • @usuariodefectuoso4046
      @usuariodefectuoso4046 4 месяца назад +3

      Yeah, i had to download the src material to see that on index.html these lines are added inside of the for loop (it sanitizes the title to prevent HTML injection) :
      let title = shows[id].title.replace('

    • @caiofernando
      @caiofernando 4 месяца назад

      @@usuariodefectuoso4046 Yeah, I was able to find the answer in the notes as well!

  • @01juniorpen
    @01juniorpen 5 месяцев назад +1

    01:40:00

  • @ChristopherBruns-o7o
    @ChristopherBruns-o7o 3 месяца назад

    1:03:55 can't you use base64 and assign an id to get Sports in hex and css the id tag?

  • @BarronMartinez-tz1up
    @BarronMartinez-tz1up 6 месяцев назад

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

    • @Hillgrov
      @Hillgrov 5 месяцев назад

      hopefully you know this by heart if you're going to apply for a webdev job :S

    • @Alec0
      @Alec0 5 месяцев назад

      How did it go?

    • @kidzeeplier2468
      @kidzeeplier2468 3 месяца назад

      how did it go?

    • @Hillgrov
      @Hillgrov 3 месяца назад

      @@kidzeeplier2468 guess OP lost all hope and moved into the wilderness.

    • @kidzeeplier2468
      @kidzeeplier2468 3 месяца назад

      @@Hillgrov and..he was never seen again.

  • @aopen130
    @aopen130 7 месяцев назад +2

    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.😅

  • @quang.luu.179
    @quang.luu.179 4 месяца назад

    👍👍👍

  • @GucciJohanne
    @GucciJohanne 7 месяцев назад +1

    had to watch this at 0.9 speed LOL 😅

  • @TheImaginativeSachin
    @TheImaginativeSachin 14 дней назад

    1:10:58 As soon as you put a web application on the internet, bad things will happen to it! 😂
    So true!

  • @Nikita_Code
    @Nikita_Code 7 месяцев назад +4

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

  • @hemelhasan348
    @hemelhasan348 6 месяцев назад

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

  • @e.n85784
    @e.n85784 3 месяца назад

    I wonder if Yale will add the term "boilerplate" to their Bingo card

  • @jazzyniko
    @jazzyniko 8 месяцев назад +1

    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 8 месяцев назад +3

      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.

  • @ansh4131
    @ansh4131 Месяц назад

    42:00

  • @Dpk_YT
    @Dpk_YT 10 месяцев назад

    ❤❤

  • @chrikke
    @chrikke Месяц назад

    If only there was a language that could do this kind of server side rendering lol

  • @xiuzhenyang8047
    @xiuzhenyang8047 6 месяцев назад +1

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

    • @boncoderz1430
      @boncoderz1430 5 месяцев назад +1

      Click Open in integrated terminal after u right click any file in ur vsc.

    • @xiuzhenyang8047
      @xiuzhenyang8047 4 месяца назад

      @@boncoderz1430 Thank you!!

  • @RomarioKurti28
    @RomarioKurti28 9 месяцев назад

    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 8 месяцев назад +1

      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

  • @bpopphixo9627
    @bpopphixo9627 Месяц назад

    Help me i don't know what i need to remember

  • @tinvan8146
    @tinvan8146 2 месяца назад

    1:01:16 his voice xD

  • @chal7z
    @chal7z 3 месяца назад

  • @SkepticLens
    @SkepticLens 10 месяцев назад +1

    2nd comment?

  • @danilbanan406
    @danilbanan406 10 месяцев назад +3

    Why they using flask ? Why not FastApi

    • @hiramarturooliveromuoz3728
      @hiramarturooliveromuoz3728 9 месяцев назад

      Flask is better

    • @LoadNewYear
      @LoadNewYear 7 месяцев назад +1

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

    • @bekay7663
      @bekay7663 6 месяцев назад +1

      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.

  • @ferabreu1980
    @ferabreu1980 7 месяцев назад +3

    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. 😂

    • @JeremyMitts
      @JeremyMitts 4 месяца назад +2

      If that's the case, David deserves an Oscar. It was the most believable acting I've ever witnessed...
      (stop it. humans make mistakes.)

    • @7amseel
      @7amseel 4 месяца назад +2

      I also suspect that a little bit. Because they are so prepared for everything, like every tiny detail to be mentioned is included in the slides and the code. Even the mistakes are intentionally designed so that David can teach the process of improving code instead of impossibly trying to get it perfect the first time.
      So, I have no reason to believe that they hadn't actually worked it all before and it accidentally was mistyped in his printouts.
      But still can't rule out the other possibility cuz we are all humans. (Somebody ask CS50 staff. I am curious!)

    • @SathvikP-v3v
      @SathvikP-v3v 2 месяца назад

      I also think the same. Even though there exist so many platforms where you could debug errors, the team wants us to use the duck instead of other platforms which would limit taking help everytime. That was pre-planned for sure !

  • @Rapha_Carpio
    @Rapha_Carpio 2 месяца назад

    40:05 what happen with these people, they dont ask question having the opportunity of be with this guy face 2 face........