In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to achieve Flask user accounts and profile picture functions, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
Today, we will implement the functions of updating user accounts and uploading personal avatars in the Flask_Blog project. Let's start with:
Create a new folder pics in Flask_Blog\ flaskblog\ static to save the profile picture uploaded by the user as well as the default profile picture default.jpg:
Modify Flask_Blog\ flaskblog\ forms.py, add the update account information form, and verify that only two JPG,PNG formats are supported for image upload:
Modify Flask_Blog\ flaskblog\ routes.py, add the method of saving avatar, modify the method of account information, use the previously learned image processing module Pillow when saving the image, and save the image after changing the overall size of the image to ensure that the size of the avatar is the same and takes up little space:
Modify Flask_Blog\ flaskblog\ templates\ account.html to design the form. Note that the enctype of form should be specified, otherwise the file will not be uploaded successfully:
Then we open the command line cmd in the folder Flask_Blog, run python run.py, access http://127.0.0.1:5000/, login account password, click on the account information, display the default account avatar, user name, mailbox, and update avatar selection:
Click to select the file, and then click the update button to submit the modified content:
Then we manually register a new user test with the email address of test@email.com, and then modify the admin account information. There will be repeated verification prompts:
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.