Python Flask Tutorial: Full-Featured Web App Part 7 - User Account and Profile Picture

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024

ความคิดเห็น • 465

  • @MistaT44
    @MistaT44 6 ปีที่แล้ว +189

    I'm in my final semester of my degree right now! and the first thing I am going to do as soon as I land a job is to support this channel! This series is just AMAZING!

  • @kirkkenney6510
    @kirkkenney6510 5 ปีที่แล้ว +59

    For anyone wanting to delete the previous profile picture while adding a new one, I added this just before the return statement in the save_picture function:
    prev_picture = os.path.join(app.root_path, 'static/profile_pics', current_user.image_file)
    if os.path.exists(prev_picture):
    os.remove(prev_picture)

    • @123qopsiznoq
      @123qopsiznoq 4 ปีที่แล้ว +1

      thank you :)

    • @darynaishchuk5350
      @darynaishchuk5350 4 ปีที่แล้ว +10

      You also need to check that previous picture wasn't the default one, because it will also be deleted.

    • @marconarca2706
      @marconarca2706 4 ปีที่แล้ว

      @@darynaishchuk5350 yeah i thought also

    • @heisenburgfreed7591
      @heisenburgfreed7591 4 ปีที่แล้ว +16

      The code for anyone who wants to delete the previous profile picture (but never delete the default.jpg) while adding a new one, please add the below code block before the return statement inside the save_picture function:
      # Code Block Starts
      prev_picture = os.path.join(app.root_path, 'static/profile_pics', current_user.image_file)
      if os.path.exists(prev_picture) and os.path.basename(prev_picture) != 'default.jpg':
      os.remove(prev_picture)
      # Code Block Ends

    • @user-sg7yd5il3z
      @user-sg7yd5il3z 3 ปีที่แล้ว +4

      @@heisenburgfreed7591 could just do
      and current_user.image_file != 'default.jpg':
      either one works. Yours kinda keeps it more consistent with the os.path thing
      Thanks OP. Was struggling with this before this comment.

  • @ian_senior
    @ian_senior 4 ปีที่แล้ว +42

    loving this tutorial!
    i added the code to delete the old profile pic when updating with a new one. this is the if statement in the account function in routes.py
    ```
    if form.picture.data:
    old_pic = current_user.image_file
    picture_file = save_picture(form.picture.data)
    current_user.image_file = picture_file
    if old_pic != 'default.jpg':
    os.remove(os.path.join(app.root_path, 'static/profile_pics', old_pic))
    ```

  • @codewithgedo3067
    @codewithgedo3067 2 หลายเดือนก่อน +1

    In 2024, this is still the best Flask tutorial on the Internet due to its comprehensive coverage of topics, clear explanations, and up-to-date practices.

  • @soumyajitdey5720
    @soumyajitdey5720 4 ปีที่แล้ว +29

    Corey! I have an interview tomorrow wish me luck! If I get this job the first thing I'll do is support you through Patreon with my first salary. You have taught things so efficiently that no professor has ever taught in these semesters for graduation. You're such a kind person for teaching such valuable content with this brilliant quantity without charging a penny!

    • @soumyajitdey5720
      @soumyajitdey5720 4 ปีที่แล้ว +13

      @Raptr3x yes mate I got the job. Currently working as a Data Engineer. 😊

    • @davidcairuz
      @davidcairuz 3 ปีที่แล้ว

      @@soumyajitdey5720 Nice, congrats! :D

    • @darius349
      @darius349 3 ปีที่แล้ว

      @@soumyajitdey5720 Congratulations!!

    • @temiloluwaadebowale2553
      @temiloluwaadebowale2553 3 ปีที่แล้ว +1

      @@soumyajitdey5720 What path would you recommend (or did you take) on your way to becoming a data engineer?
      Also I'd like to connect with you on LinkedIn or an other social platform.
      Thanks!

    • @CodeWithCharan_
      @CodeWithCharan_ 10 หลายเดือนก่อน +1

      How r u doing broo

  • @arseneawounou180
    @arseneawounou180 2 ปีที่แล้ว +4

    Watching this series 4 years later and I strongly recommend. Learning a lot.

  • @rusinsr
    @rusinsr 6 ปีที่แล้ว +50

    The pacing of these tutorials and your explanations are just incredible! Shared the series with my Python friends :)

  • @tylmomendog
    @tylmomendog 6 ปีที่แล้ว +112

    Fantastic series, Corey. Pacing, content, thoroughness, and execution is just great. Thank you for the quality content!

    • @xtrzne
      @xtrzne 2 ปีที่แล้ว

      Can anyone clarify if the profile picture is being fetched from the server or from the local filesystem (when GET request is called on the account page)? To me it seems like while the file name is sent to the SQL database, the actual image isn't being sent to the database at all?

    • @kizernis
      @kizernis ปีที่แล้ว

      ​@@xtrzne A little late, but I'll answer for those who wonder. After a picture is selected from a local file system on the webpage, it's being put (its resized copy) onto the local filesystem *by the server* (which is now being run locally) into *static/profile_pics* directory. Only the filename goes into the database. It's often a bad thing to store bitmaps in the database as blobs.

  • @arinzealex
    @arinzealex 4 ปีที่แล้ว +4

    I really love the fact that whenever I run into any error following these amazing tutorials, the error has been asked and answered in the comments :)

  • @kizernis
    @kizernis ปีที่แล้ว +1

    Mr. Schafer is like a teaching machine! Always keeps all things in mind and never stutters or says anything unnecessary!

  • @chakibbrikcisid5474
    @chakibbrikcisid5474 5 ปีที่แล้ว +18

    Duuuuuuuuuuuude, you're a beeeaaaaaaaaaast !
    Your tutorials are awesome ! keep the good work !
    If you could put a series about Laravel that would be dope !
    You got some high quality skills in teaching !
    Thanks a lot !

    • @coreyms
      @coreyms  5 ปีที่แล้ว +4

      Thanks!

  • @AbhishekNigam
    @AbhishekNigam 6 ปีที่แล้ว +4

    This is has become on of the best code tutorials I've ever watched on TH-cam!

    • @coreyms
      @coreyms  6 ปีที่แล้ว +3

      Thanks!

  • @RandomShowerThoughts
    @RandomShowerThoughts 6 ปีที่แล้ว +8

    One of the best tutorials on anything i've ever watched

    • @DJDedBeat
      @DJDedBeat 4 ปีที่แล้ว

      nice pfp

  • @ryszardkalisz733
    @ryszardkalisz733 5 ปีที่แล้ว +6

    Thank you for the best content when it comes to python and Flask tutorials.
    I tried to learn Flask a little too early in my programming journey and when i was stuck i started to search for another tutorial instead of improving my skills.
    I came back crawling to you Corey QUICK.
    Thank you!

  • @MuskanMall-y6d
    @MuskanMall-y6d 10 หลายเดือนก่อน

    I have no experience using any backend framework, except some basic django...
    I did not expect such an amazing quality from a TH-cam tutorial, which is free!
    thankyou!
    this is an amazing series!
    you're god sent for broke students!

  • @serta5727
    @serta5727 4 ปีที่แล้ว +2

    Seriously been searching for days for a complete flask webapp build tutorial. This and from sentdex were the BEST!

  • @jimmydesilva
    @jimmydesilva 6 ปีที่แล้ว +3

    In order to make the picture upload work on the current version of Python and Flask, in "forms.py" I had to change:
    [code]
    picture = FileField('Update profile picture', validators=[FileAllowed('jpg', 'png')])
    [/code]
    to:
    [code]
    picture = FileField('image', validators=[FileRequired(), FileAllowed(['jpg', 'png'], 'Images only!')])
    [/code]
    Last but not least, thank you for the great series!

    • @h82fail
      @h82fail 6 ปีที่แล้ว +4

      I think you only had a problem because you forgot to put the file types into a list. [FileAllowed('jpg', 'png')]) should have been [FileAllowed(['jpg', 'png'])]). He had the brackets correct in the video and it worked for me on the newest version. When I was following along I wasnt expecting to have to use the list, so I'm guessing you thought the same and didn't notice him do it.

    • @jimmydesilva
      @jimmydesilva 6 ปีที่แล้ว

      @@h82fail I see what I did wrong now. Thanks for pointing it out!

  • @Thattyguy_
    @Thattyguy_ 6 ปีที่แล้ว +3

    I like how you started referencing where we set the variable in the past, helps keep track of structure better

  • @vinodhr8805
    @vinodhr8805 5 ปีที่แล้ว +4

    Corey, Your python videos are really amazing. I started python programming after a decade and I'm into it now. But my job is mostly in automation testing. Wanted to change to development and picked your series. Can't stop in btw, yesterday I started and now I'm in part 7. With this video reference, I can able to build the website. Amazing Work!!

  • @lightninginmyhands4878
    @lightninginmyhands4878 5 ปีที่แล้ว +6

    Another LEGENDARY vid!
    When I saw you install Pillow, I thought to myself "Python is like the car, and these extensions are like aftermarket parts... " :)

  • @alexkalopsia
    @alexkalopsia 4 ปีที่แล้ว +5

    If you want to prevent avatars from stretching, add object-fit:cover; to the .account-img class in main.css

  • @PedroHenrique-ne3zm
    @PedroHenrique-ne3zm ปีที่แล้ว

    Hello, my name is Pedro and I live in São Paulo, I am writing this text to thank you immensely because you are not only helping me in my professional life but also in my academic life. Keep being this amazing person that you are and may there be others like you over the years, thank you very much.

  • @investmentapps7826
    @investmentapps7826 3 ปีที่แล้ว +1

    I am glad I make typos i.e. pictures instead of picture. Helps me understand when I troubleshoot issues. Thank you,

  • @souravpal6406
    @souravpal6406 4 ปีที่แล้ว +1

    This tutorial is way better than some of the payed courses online. Thank you. This is excellent...

  • @rahulsailwal4025
    @rahulsailwal4025 4 ปีที่แล้ว +1

    every bit i m developing while seeing your videos making me so happy and the reason is you.
    Thank you so much for amazing video...God bless you.

  • @dawnS33ker
    @dawnS33ker ปีที่แล้ว +1

    Corey, I can't thank you enough for this series. Amazing work..

  • @ErickG
    @ErickG 5 ปีที่แล้ว +8

    I've never felt dumber and smarter while watching a video. I guess that's still progress. Thank you

  • @plusk343
    @plusk343 4 ปีที่แล้ว +6

    I am a teen. As soon as I land a settled job, I am gonna support this channel
    Remember This Comment

    • @plusk343
      @plusk343 3 ปีที่แล้ว +1

      @@photon6156 cool, see you here after 6 years

    • @plusk343
      @plusk343 9 หลายเดือนก่อน

      yo i am here, 3 years before time

    • @plusk343
      @plusk343 9 หลายเดือนก่อน

      i have the money now

    • @plusk343
      @plusk343 9 หลายเดือนก่อน

      i just turned 18 like 10 days ago, im gonna get my paypal and support this guy

  • @ahmadabdallah2896
    @ahmadabdallah2896 5 ปีที่แล้ว +19

    Dude your dog is so cute omg

  • @sknganga3633
    @sknganga3633 3 ปีที่แล้ว +1

    corey schafer is forever a legend!

  • @SAGARSHARMA-cd8pj
    @SAGARSHARMA-cd8pj 6 ปีที่แล้ว +1

    For the profile picture @21:57 , I had to change
    picture = FileField( 'Update Profile Picture', validators= [ FileAllowed ( [ 'jpg', 'png' ] ) ] )
    to
    picture = FileField( 'Update Profile Picture', validators=[ FileRequired(), FileAllowed ( [ 'jpg', 'png' ] ) ] )
    and also
    import FileRequired
    at the starting of the file.
    maybe because I'm using Python3.5 and not 3.6
    Thanks for the awesome tutorials @CoreySchafer

    • @geom8235
      @geom8235 5 ปีที่แล้ว

      thanks, brother!

  • @TheGlenn1976
    @TheGlenn1976 5 ปีที่แล้ว +1

    as a zero knowledge person about coding, i wonder how did I able to go this far in the series(Part 8) and be able to successfully roll out the apps. Thank you for these videos. I am very excited finishing this apps.

  • @VitorAraujo010
    @VitorAraujo010 4 ปีที่แล้ว +2

    These are sensational tutorials Corey, thanks and please expand on the features!

  • @taruneagles1
    @taruneagles1 6 ปีที่แล้ว +2

    Just fyi, this video used
    picture_path = os.path.join(app.root_path + "static/profile_pics" + picture_fn)
    Corey is using mac, and it works for him, but for people using windows please use:
    picture_path = os.path.join(app.root_path + r"\static\profile_pics\\" + picture_fn)

    • @coreyms
      @coreyms  6 ปีที่แล้ว +2

      Thanks for catching that! I think the best solution is to simply pass in static and profile_pics as different arguments like so...
      picture_path = os.path.join(app.root_path, "static", "profile_pics", picture_fn)
      I will issue a correction in the next video I add to this series. Thanks again!

    • @taruneagles1
      @taruneagles1 6 ปีที่แล้ว

      Yup, join should take care of that.
      Thanks for these tutorials Corey. Really appreciate em.
      I am not as fast as the other guys, who finished these tutorials in a day or two. I am on week two. :)

    • @Leonardo200467
      @Leonardo200467 2 ปีที่แล้ว +1

      Hey just coming here after 3y to thank you alot, lifesaver comment

  • @gonzalopolo2612
    @gonzalopolo2612 5 ปีที่แล้ว +2

    This videos are amazing and complete, support this channel is a must!
    Just a question for the audience, to see if someone is having the same problem:
    - On the account route, when updating the current_user.name and current_user.email with the form data, then doing the db.session.commit() is not updating the DB but the commit returns None as if everything was Ok, has somebody run into the same problem??
    Thank you very much again!

    • @satriolelono8447
      @satriolelono8447 4 ปีที่แล้ว

      I have the same problem. Have you found the solution for this?

    • @danibilel3415
      @danibilel3415 4 ปีที่แล้ว

      same

  • @DocPosture
    @DocPosture 6 ปีที่แล้ว +2

    even on these longer vids, the pacing is spot on. subscribed

  • @sivarampatamsetti2262
    @sivarampatamsetti2262 4 ปีที่แล้ว

    I WONDER !!!!!
    how much practice it takes to teach like this
    💯 helpful
    GREAT,THANK YOU.

  • @IncognitoAtreides
    @IncognitoAtreides 3 ปีที่แล้ว

    This is even better than the CS50 Webapp tutorials at Uni!

  • @vgbond2423
    @vgbond2423 2 ปีที่แล้ว +1

    tbh, this is the best flask tutttoriallll for beginnerr.....

  • @MistaT44
    @MistaT44 6 ปีที่แล้ว +3

    I guarantee you'd be a millionaire if these were paid courses. thankyou for providing this godlike content for absolutely free!

  • @rahultiwari4309
    @rahultiwari4309 4 ปีที่แล้ว

    A video of master Corey just make my day like nothing

  • @kartikxramesh
    @kartikxramesh 4 ปีที่แล้ว +3

    What a cute photo of your dog! Looks like a good boy.

  • @isevitt
    @isevitt 4 ปีที่แล้ว +2

    I fell in love with Flask because of you :)

  • @zainbaloch5541
    @zainbaloch5541 5 ปีที่แล้ว +3

    Quality content continues. Respect from Pakistan!

  • @alvinwafulalusenaka1247
    @alvinwafulalusenaka1247 5 ปีที่แล้ว +1

    You are the best thing that has ever happened to me! I thank you very much. Thank you for existing!

  • @purplefan204
    @purplefan204 ปีที่แล้ว +1

    Great series Corey! Can't thank you enough.

  •  4 ปีที่แล้ว +1

    Realy impressive tutorials with legendary explanations. Thanks !!!

  • @MmmBopsPops
    @MmmBopsPops 4 ปีที่แล้ว +9

    29:00 - Even though the likelihood of two 8-byte numbers being the same is astronomical, might as well check to make sure the image doesn't already exist and if so, regenerate a new hex.

    • @swordthrower
      @swordthrower 4 ปีที่แล้ว

      Ha! When I got to that part I thought the same thing and immediately checked the comments to see if anyone else did too... Agree that it's incredibly unlikely, but better safe than sorry.

    • @BtheDUB
      @BtheDUB 4 ปีที่แล้ว

      How would you do this? Query the DB , right just like earlier with usernames and emails?

    • @kardeslermc-berk583
      @kardeslermc-berk583 4 ปีที่แล้ว +2

      @@BtheDUB Actually you would probably have to check the profile_pics folder with the os.listdir() function and compare them to generated hex. If the file already exists, regenerate new hex. But as been told, that's not very likely.

  • @marc-olivierblouin4709
    @marc-olivierblouin4709 6 ปีที่แล้ว +1

    Love the Flask-Series!! Keep it up

  • @hahaha5418
    @hahaha5418 5 ปีที่แล้ว +1

    Love from Bangladesh, You're so amazing...thanks Corey Schafer.

  • @luuvinhtuong4490
    @luuvinhtuong4490 5 ปีที่แล้ว +1

    i love your series, very helpful, very clearly, thanks so much

  • @aleksandrshirokov9037
    @aleksandrshirokov9037 6 ปีที่แล้ว +7

    great tutorial, but the puppy is amazing!!!

    • @coreyms
      @coreyms  6 ปีที่แล้ว +2

      Haha thanks

  • @АртурРожков-в8ф
    @АртурРожков-в8ф 5 ปีที่แล้ว +2

    Thank you from Armenia,m you are amazing!!!

  • @JoshuaBlais
    @JoshuaBlais 5 ปีที่แล้ว +1

    This series is awesome, thank you so much! Subbed!!

  • @CoinBahd
    @CoinBahd 3 ปีที่แล้ว

    damn this tutorial series really has it all.

  • @OpteroNN
    @OpteroNN 4 ปีที่แล้ว +1

    Great tutorial series! Thanks so much!

  • @david0411
    @david0411 ปีที่แล้ว +3

    For those wondering how to remove the previous image from the profile_pics directory after updating the profile picture. It's just as simple as adding this line in the save_picture() function:
    - if current_user.image_file != 'default.jpg:
    os.remove(os.path.join(app.root_path,
    'static/profile_pics', current_user.image_file))
    It has be added before this line:
    - i.save(picture_path)
    Let me know if someone find another solution!

  • @Metachief_X
    @Metachief_X 5 ปีที่แล้ว +1

    this series is EPIC

  • @gamedev1380
    @gamedev1380 5 ปีที่แล้ว +1

    Hi Corey, not sure if you're still reading these comments. Loving the tutorials. Am up to the end of this video. Pillow is installed for PIP. Run the code and I get the following error.
    website_1 | File "/logrr/logrr/blueprints/login/views.py", line 74, in accountPage
    website_1 | picture_file = save_picture(form.picture.data)
    website_1 | File "/logrr/logrr/blueprints/login/views.py", line 57, in save_picture
    website_1 | i.save(picture_path)
    website_1 | File "/usr/local/lib/python3.7/site-packages/PIL/Image.py", line 2004, in save
    website_1 | fp = builtins.open(filename, "w+b")
    website_1 | FileNotFoundError: [Errno 2] No such file or directory: '/logrr/static/images/profile_pics/757b0bf5ed6b98cb.jpg'
    I check and sure enough, in the profile_pics folder there is no file. I changed permissions so that all users can access the folder with full access so it can't be that.
    Line 74 is calling the save function:
    picture_file = save_picture(form.picture.data)
    Line 57 is the actual save line in the function:
    i.save(picture_path)
    What could be wrong? I'm a little stumped. Thank you

    • @orcunsamitandogan
      @orcunsamitandogan ปีที่แล้ว

      Hey, I know time passed but it worths to ask. I have same problem and tried same things. Have you found any solution?

    • @orcunsamitandogan
      @orcunsamitandogan ปีที่แล้ว

      Now I solved. Problem is this: when we delete the first section of the file, we also delete the name of uploading* object. However, we need it. File we download has also hex-like naming. In fact, we need first and second section of life. My solution for this deactivate the random_hex. In this way, I was able to upload it. However, I am not sure, what kind of security issue it can cause.
      f_first, f_ext = os.path.splitext(form_picture.filename)
      picture_fn = f_first + f_ext
      With this, I am able to upload a new picture.

  • @amiraslanbakhshili5420
    @amiraslanbakhshili5420 5 ปีที่แล้ว +1

    Thank you! Incredible content, loved it

  • @quechon1
    @quechon1 6 ปีที่แล้ว

    Hey man great job on the whole flask playlist

    • @coreyms
      @coreyms  6 ปีที่แล้ว

      Thanks!

  • @aifsssm
    @aifsssm 5 ปีที่แล้ว +1

    superb tutorial! thank you very much man.

  • @WaldoTheWombat
    @WaldoTheWombat 3 ปีที่แล้ว +1

    Hi, I need help with forms please.
    In the home page, I'm trying to add a capability for users to add comments for each post without going to a different page. Since each comment would belong to a specific post, I need to pass the post's id from the HTML back to the route function in Python along with the actual content of the comment so I could save it in my DB.
    passing the title of the comment is no problem, you just render wtform field with jinja2 and then the user fills it up (as Corey shows)
    but how do create add a dynamic value for the form while inside the HTML?
    I've tried with jinja2: {% set form.post_id.data = 'whatever' %} but got
    jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got '.'

  • @josepharenas8905
    @josepharenas8905 5 ปีที่แล้ว

    Guess how many times I came back to this series

  • @electromorphous
    @electromorphous 4 ปีที่แล้ว +1

    That doggo is real cute!

  • @oleksandrasaskia
    @oleksandrasaskia 4 ปีที่แล้ว +1

    Would be super interesting to add how to auth with GMail, for instance.

  • @evelyns5218
    @evelyns5218 3 ปีที่แล้ว

    Hi Corey, Excellent video, this was extremely helpful! Can you add a quick video to show us how we can add pictures and video files to each post? I would like the user to have the ability to include photos from their desktop and add to their posts. I love that they can add photos to their profile and would like to provide the option for them to include photos within their posts as well. Thanks so much!!

  • @mouradelcadi
    @mouradelcadi 4 ปีที่แล้ว

    thank you so much sir you are the best i think this channel is the best , really great content

  • @georgezuo4620
    @georgezuo4620 3 ปีที่แล้ว +1

    Something that I noticed is Emails are NOT case sensitive and that should be taken into account when making a website that requires email or else people can sign up for multiple account using same email by changing capitalization their email.

  • @atharvahiwase1574
    @atharvahiwase1574 4 ปีที่แล้ว +1

    I did exactly what you did on tutorial but even after uploading the picture it doesn't appear on the account page

  • @Dipenparmar12
    @Dipenparmar12 ปีที่แล้ว

    Amazing tutorial.. thank you for your efforts

  • @paulmorenkov
    @paulmorenkov 5 ปีที่แล้ว +3

    Wow, thank you for these great videos! I mostly program as a hobby, and have had trouble finding good resources on web development, and was honestly quite intimidated, but you, as always, provide a great series!
    I have a question about the render_template() function: what determines whether or not you need to pass a variable to it? For example, `title` and `image_file` are passed in, but current_user isn’t, but still works fine in the template.
    Thank you again!

    • @brianwahome5789
      @brianwahome5789 5 ปีที่แล้ว

      These are all optional parameters and are autoscaled into the function as context variables. The only required parameter is the resource template which is our actual html. The rest can be left out and can be either made use of or ignored. render template is coded to be as flexible as possible hence the use of autoscaping here (**). Its why that one function works for, taking in as many parameters as needed without needing restructuring of the function.

  • @habib-urrehman3094
    @habib-urrehman3094 5 ปีที่แล้ว +1

    great work, amazing help.

  • @jean-charlesb.7360
    @jean-charlesb.7360 6 ปีที่แล้ว +1

    Great videos! Thank you very much!

  • @jonathanthurgood5558
    @jonathanthurgood5558 3 ปีที่แล้ว +1

    At about 28:22 Corey mentioned that the Secrets module has been used earlier in the series, but I'm totally blanking on that. Can anyone be a bro and let me know which video and rough time that was?

    • @11irishjs51
      @11irishjs51 3 ปีที่แล้ว +1

      It was in Part 3 at about 11:00 minutes. We used it to generate a random string of characters for our secret key.

  • @santabaltmane9762
    @santabaltmane9762 4 ปีที่แล้ว

    While your puppy picture was on I heard nothing you said :D In my mind only "AAAWWWWWW, CUUUUTTTEEE"!

  • @dhruvgupta8278
    @dhruvgupta8278 4 ปีที่แล้ว

    Your videos are magical

  • @rdd9558
    @rdd9558 4 ปีที่แล้ว +1

    very nice Corey !

  • @zaph254
    @zaph254 ปีที่แล้ว

    I really love the series and am really having fun, I just have one question on this module though...I thought we will be sending the images the users upload to the database, why are we sending them to the static folder? Is this how real world web apps work, or is there a way to send these images to a database.?
    Otherwise, am moving to the next module, and that is the one for creating, updating and deleting posts, Pure fun

  • @h82fail
    @h82fail 6 ปีที่แล้ว

    Decided on Part 3 when I noticed all the repeated/copy and pasted code in the register.html, especially after putting in the if errors code I was going to keep it DRY and find a better way. Now after doing the account form as well I have made it really cleanly.
    In register.html, login.html, account.html in place of ...... I just put {% include 'includes/_form.html' %}
    Then I made a includes/_form.html:
    {{ form.hidden_tag() }}
    {{ form_title }}

  • @jiandeng8595
    @jiandeng8595 6 ปีที่แล้ว

    @13:35, we can use `ctrl+shift+;` to delete the html tag in sublime

  • @Daiphiron
    @Daiphiron 4 ปีที่แล้ว

    I really love your tutorials. This series specially helps me a lot. But man ... i usually play tuts with 1.25 even as non native english speaker .. but you are that fast o0

  • @aakashtiwari3974
    @aakashtiwari3974 4 ปีที่แล้ว +1

    Talented Corey Thanku

  • @ayushroy2244
    @ayushroy2244 5 ปีที่แล้ว +5

    I am having some errors in the save_picture() part

  • @anildhage
    @anildhage 3 ปีที่แล้ว

    Hello Sir,
    I have a question for you. You have a great experience with python and flask before creating this playlist, I want to know your approach on this topic. Before creating this project in this playlist, how much time did you take to get this fluency in the flask model? How many projects do you recommend I to create and build to get this kind of fluency. Your answer will motivate me.
    Great content by the way, I am learning a lot from you. Thank you for your effort on this.

  • @Lucas-qr7ul
    @Lucas-qr7ul 4 ปีที่แล้ว

    There is a problem if we have more than one account in the system.
    I was having an issue where I was uploading a picture to my profile but it was displaying the same picture uploaded to all users. The problem was that I was passing the variable image_file to the template set to current_user, like this:
    "image_file = url_for(
    'static', filename='img/profile/' + current_user.image_file)"
    To solve it I added to my route so I could get the user id from the navbar (I had to add a variable "user_id=current_user.id" in my layout.html). I passed the parameter called "user_id" into the "account" function and defined a "user" variable then I used this "user" instead of "current_user" in the "image_file". However, I also had to pass "user_id=current_user.id" back when I redirected the page, like so:
    layout.html
    Account
    routes
    "@app.route("/account//", methods=["GET", "POST"])
    def account(user_id):
    user = User.query.filter_by(id=user_id).first_or_404()
    ....
    .....
    return redirect(url_for("account", user_id=current_user.id))
    image_file = url_for(
    'static', filename='img/profile/' + user.image_file)"
    In case anyone runs into this problem.

  • @headlessdonkey01
    @headlessdonkey01 5 ปีที่แล้ว

    great video, really helped me understand some cool tricks with flask. Corey, i was wondering if you could give an example of how to remove the image files from the file directory upon updating profile picture. Thanks again

  • @mvi6039
    @mvi6039 3 ปีที่แล้ว

    Your dog is lovely!

  • @noureddineettayyeby5210
    @noureddineettayyeby5210 4 ปีที่แล้ว +1

    Thank you

  • @drac8854
    @drac8854 5 ปีที่แล้ว +1

    @Corey
    I dont think that current_user.username = form.username.data
    Changes value in database
    And i think that the reason why my code isn't working

  • @rishavtiwari2017
    @rishavtiwari2017 ปีที่แล้ว +1

    The ValidationError message is not showing in my one. Can somebody help please?

  • @jaideepadhvaryu9642
    @jaideepadhvaryu9642 5 ปีที่แล้ว

    Once again, every video is excellent. Thank you for your effort and offering to rest of us. Few questions:
    - I am planning to use Google App Engine + Python 3 + Flask. Will this work?
    - Also, i want to use GCP's datastore and upcoming firestore. Since we are using sqlalchemy, will it work out of box?
    - do you have similar example of using Firebase's user authentication.

  • @mojostrowinsky5235
    @mojostrowinsky5235 4 ปีที่แล้ว

    Amazing. Thank you so much!

  • @uokriljuislama9146
    @uokriljuislama9146 4 ปีที่แล้ว +2

    Hey Corey! The update picture thing is not working nowadays... I suppose the python version changed and something got messed up. Do you or anyone else care to help beginner debuggers to get these features up and running again? :D thanks a lot :D

    • @haseebabbas6305
      @haseebabbas6305 4 ปีที่แล้ว

      Hey there!! have you found the solution?? I'm a beginner too..

    • @JoanApita
      @JoanApita 4 ปีที่แล้ว

      I just finished the tutorial works fine on my side. what is the error message?

  • @joelexperienced
    @joelexperienced 2 ปีที่แล้ว

    your puppy is beautiful

  • @wingielee
    @wingielee 4 ปีที่แล้ว +1

    impressive and analogical.....

  • @madhuriprasad5416
    @madhuriprasad5416 3 ปีที่แล้ว

    Really very nice tutorials Corey. Went through all your videos Django, Flask . Thank you. Hope you would reply my question:
    How you will know that you need that form or anything to imported if it’s by going through documentation how you manage to go through all the content because one page leads to many sub topics? I really wish you could reply or make a video on this . Thank you once
    again 😊.

  • @kchemutai3483
    @kchemutai3483 5 ปีที่แล้ว +1

    This Videos Really make Programming easy. Thanks Corey for the great content. Do you have a Link of the Django version of this content

  • @GPBrachetta
    @GPBrachetta 4 ปีที่แล้ว +1

    Would it be possible to style the "choose file" button to match the theme? Now all the block is clickable. Thanks!

  • @brumleblichfeldt4025
    @brumleblichfeldt4025 2 ปีที่แล้ว

    Love these videos, easy to follow and of just the right length. :) Have a question tho... when I upload a .jpg the orientation changes, is it possible to add some code to prevent that?