CS50x 2024 - Lecture 9 - Flask

***
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
kzread.info_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
KZread: / 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

Пікірлер: 77

  • @-.lucas.vieira.-
    @-.lucas.vieira.-9 күн бұрын

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

  • @Damonbodine
    @Damonbodine3 ай бұрын

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

  • @stepanrusinko2456
    @stepanrusinko24565 ай бұрын

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

  • @lpdemodimi

    @lpdemodimi

    4 ай бұрын

    This is the way.

  • @FlowersByIrene

    @FlowersByIrene

    3 ай бұрын

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

  • @dwkeirstead
    @dwkeirstead3 ай бұрын

    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…

  • @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

  • @lpdemodimi
    @lpdemodimi4 ай бұрын

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

  • @Piranha_Dark
    @Piranha_Dark5 ай бұрын

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

  • @UnboxRacing
    @UnboxRacing8 күн бұрын

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

  • @faizanahmed9304
    @faizanahmed93045 ай бұрын

    Thank you team @CS50

  • @Aman-fz1ew
    @Aman-fz1ew4 ай бұрын

    Awesone Video . Simultaneously coding helps to understand the concept

  • @shivayshakti6575

    @shivayshakti6575

    3 ай бұрын

    Do you use fuel monitor.

  • @MazineZ
    @MazineZ4 ай бұрын

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

  • @johnpasir3207
    @johnpasir32073 ай бұрын

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

  • @teaganp5011
    @teaganp501116 күн бұрын

    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

  • @MarkBetterDev
    @MarkBetterDev5 ай бұрын

    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 ай бұрын

    this course is really easy

  • @berkeumutsahinturk921

    @berkeumutsahinturk921

    4 ай бұрын

    just no@@prcvl

  • @harshpalsinhzala1092

    @harshpalsinhzala1092

    4 ай бұрын

    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 ай бұрын

    @@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 ай бұрын

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

  • @alainrouleau
    @alainrouleau17 күн бұрын

    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.

  • @mr_DIY
    @mr_DIY4 ай бұрын

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

  • @BarronMartinez-tz1up
    @BarronMartinez-tz1upАй бұрын

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

  • @alex.triflesclear5827
    @alex.triflesclear58274 ай бұрын

    Finally got here, thanks god!

  • @CodingByAmp
    @CodingByAmp2 ай бұрын

    love cs50 flask

  • @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 😂

  • @user-py3rs1eq7m
    @user-py3rs1eq7m5 ай бұрын

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

  • @not_amanullah
    @not_amanullah2 ай бұрын

    This is helpful ❤

  • @yihong
    @yihong25 күн бұрын

    Thank you.

  • @viniciusalencardev
    @viniciusalencardev4 ай бұрын

    very great

  • @caiofernando
    @caiofernando9 күн бұрын

    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?

  • @RomarioKurti28
    @RomarioKurti283 ай бұрын

    Profesor is hilarious 😂

  • @grindinguy
    @grindinguy3 ай бұрын

    hardest part of the all lecture imo

  • @Herzhoz
    @Herzhoz2 ай бұрын

    This was the last one? great content, btw

  • @bastionbet3809
    @bastionbet380928 күн бұрын

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

  • @noaydev
    @noaydev2 ай бұрын

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

  • @ptd3v
    @ptd3v2 ай бұрын

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

  • @eas3csy
    @eas3csy4 күн бұрын

    Why, at 45:04, after David has changed the method to POST, does he change the subsequent code from “request.args.get” to request.form.get” and NOT “request.form.post”? Really confused.

  • @UnboxRacing
    @UnboxRacing8 күн бұрын

    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.

  • @not_amanullah
    @not_amanullah3 ай бұрын

    Understood++

  • @alainrouleau
    @alainrouleau17 күн бұрын

    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
    @RomarioKurti283 ай бұрын

    My last week 🎉🎉🎉🎉😂

  • @mikael5914
    @mikael5914Ай бұрын

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

  • @ridabrahim7604
    @ridabrahim76043 ай бұрын

    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

    3 ай бұрын

    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 ай бұрын

    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

  • @Alexander-iq5yq
    @Alexander-iq5yq3 ай бұрын

    Something weird happens at 50:27

  • @coreydubia2881

    @coreydubia2881

    3 ай бұрын

    AI generated David!🤣

  • @Dpk_YT
    @Dpk_YT4 ай бұрын

    ❤❤

  • @RomarioKurti28
    @RomarioKurti283 ай бұрын

    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

    3 ай бұрын

    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

  • @hemelhasan348
    @hemelhasan34824 күн бұрын

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

  • @user-nk6uv8ce7t
    @user-nk6uv8ce7t4 ай бұрын

    这个教程真的很牛逼

  • @Nikita_Code
    @Nikita_Code2 ай бұрын

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

  • @UnboxRacing

    @UnboxRacing

    9 күн бұрын

    Yup me too

  • @Svish_
    @Svish_16 күн бұрын

    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 😟

  • @xiuzhenyang8047
    @xiuzhenyang804717 күн бұрын

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

  • @jazzyniko
    @jazzyniko2 ай бұрын

    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 ай бұрын

    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.

  • @mallickpriyanshu
    @mallickpriyanshu2 ай бұрын

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

  • @GucciJohanne
    @GucciJohanne2 ай бұрын

    had to watch this at 0.9 speed LOL 😅

  • @danon3170
    @danon3170Ай бұрын

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

  • @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
    @danilbanan4064 ай бұрын

    Why they using flask ? Why not FastApi

  • @hiramarturooliveromuoz3728

    @hiramarturooliveromuoz3728

    3 ай бұрын

    Flask is better

  • @user-bt8ui8kl7q

    @user-bt8ui8kl7q

    2 ай бұрын

    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
    @SkepticLens5 ай бұрын

    2nd comment?

  • @FernandoMees
    @FernandoMeesАй бұрын

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