Тёмный

Intro to Flask-Login 

Pretty Printed
Подписаться 96 тыс.
Просмотров 78 тыс.
50% 1

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 109   
@prettyprinted
@prettyprinted 4 года назад
Join my free course on the basics of Flask-SQLAlchemy: prettyprinted.com/flasksql
@najeebpasha4794
@najeebpasha4794 4 года назад
why @login_maneger.user_loader not working now
@calebalfred7061
@calebalfred7061 3 года назад
sorry to be so offtopic but does anybody know of a method to get back into an instagram account..? I was stupid forgot the login password. I would love any assistance you can offer me.
@oakleyshiloh9755
@oakleyshiloh9755 3 года назад
@Caleb Alfred instablaster ;)
@calebalfred7061
@calebalfred7061 3 года назад
@Oakley Shiloh I really appreciate your reply. I found the site through google and im trying it out now. I see it takes a while so I will get back to you later when my account password hopefully is recovered.
@calebalfred7061
@calebalfred7061 3 года назад
@Oakley Shiloh It did the trick and I actually got access to my account again. I'm so happy! Thank you so much, you saved my account :D
@Cytzix
@Cytzix 5 лет назад
This channel is priceless.
@prettyprinted
@prettyprinted 5 лет назад
I'm glad you like my channel! Thanks for watching.
@OverwhelmingGrace
@OverwhelmingGrace 9 месяцев назад
I really like your tutorials. I have worked with sql databases for over 20 years and normally don't use sqlalchemy. It is a good program but it is easier for me to use sql. I know you can execute sql from sqlalchemy, but why bother if you don't use the rest of the features? I usually start by creating a class for each table and use sql to do crud operations. Most tutorials for flask-login are 80% sqlalchemy and building an entire authorization system. I already have that. All I needed was the login/logout & session information. Yours is the only tutorial I saw that did not spend most of the time building an entire auth system. As always, your video was short, to the point, and easy to follow.
@worthaglimpse
@worthaglimpse 2 года назад
your flask tutorials are lit bro . thanks a lot
@karimlameer
@karimlameer 7 лет назад
Thanks. really high quality video.
@brunodiaz6100
@brunodiaz6100 4 года назад
your type speed is incredible. good video!
@prettyprinted
@prettyprinted 7 лет назад
Thanks for watching everyone. Check out prettyprinted.com for Flask courses.
@omarmahamed622
@omarmahamed622 7 лет назад
is your website build with flask?
@prettyprinted
@prettyprinted 7 лет назад
It isn't, but the next version of it will be.
@RuanBekker
@RuanBekker 7 лет назад
awesome, as always!
@prettyprinted
@prettyprinted 7 лет назад
Thanks for watching!
@luno_b5312
@luno_b5312 7 лет назад
Awesome :) I've noticed that django does a lot of things automatically vs flask... Flask is the perfect starting point as you will understand more of the hidden django operations :) well explained video 👍
@danieldaschle
@danieldaschle 7 лет назад
yes, me to. but django is a full stack framework and flask only a minimalist. i would be great if flask has the same database skill :)
@luno_b5312
@luno_b5312 7 лет назад
Yeah agree:) I really do like django:)
@danieldaschle
@danieldaschle 7 лет назад
i tested it yesterday, firstly i think it is better than flask. but with flask classy and other extension it is way easier...
@luno_b5312
@luno_b5312 7 лет назад
Oh yeah I agree:) django is awesome, the built in functionality is awesome (admin, database and validation functionality)
@danieldaschle
@danieldaschle 7 лет назад
i prefer flask now. i saw SQLAlchemy and many other which are very good! :D
@randyhorsey
@randyhorsey Год назад
Great video! Thank you
@aldomatus6007
@aldomatus6007 3 года назад
Wow you are amazing! Thanks for your videos, You really help me
@chewanggyaltsenbhutia2407
@chewanggyaltsenbhutia2407 5 лет назад
Thank you ,for the awesome tutorial .
@prettyprinted
@prettyprinted 5 лет назад
You're welcome!
@unknown-mk8sf
@unknown-mk8sf 5 лет назад
great tutorial! thanks you sir
@charlesmoses4730
@charlesmoses4730 5 лет назад
the link for the code takes me to a site with a 404 error
@Julian-tf8nj
@Julian-tf8nj 4 года назад
A year later, it STILL gives a 404 error... apparently, no longer maintained :/
@sol-ce7ct
@sol-ce7ct 6 лет назад
great tutorial, but how about having captions? hard to follow - bit fast :(
@GaelGendre
@GaelGendre 3 года назад
Thank you!
@looploop6612
@looploop6612 4 года назад
what is "load_user" used for? you declared but did not use it
@estebanmejia9989
@estebanmejia9989 4 года назад
How can i avoid the access to a url from my site in reactjs using an api with this login?
@mesosiderite4670
@mesosiderite4670 3 года назад
thank you so much
@borbagui
@borbagui 7 лет назад
Nice tutorial, congrats!!!
@prettyprinted
@prettyprinted 7 лет назад
Thanks for watching!
@kashifkhan-il4ne
@kashifkhan-il4ne 4 года назад
please do a tutorial on flask-login with mongodb
@shivamkapoor1827
@shivamkapoor1827 5 лет назад
I cant understand the pourpose of @login_manager.user_loader please make me understand
@prettyprinted
@prettyprinted 5 лет назад
Flask-Login stores the user ID in a cookie. When it reads that cookie, it takes the user ID and calls the query in the user_loader to find the user associated with that cookie.
@ezekielchoke2580
@ezekielchoke2580 7 лет назад
Thanks for an amazing video. Do you think Flask Login (alongside with Flask-security) can be used with Flask Blueprints? What I'm concerned about is is there a way how to define the User and the db outside of the app.py file, so that everything is a bit more neatly organized?
@prettyprinted
@prettyprinted 7 лет назад
Yes, you can. Regardless of how you organize your app, you'll be able to use Flask-Login.
@ezekielchoke2580
@ezekielchoke2580 7 лет назад
Thans for the answer. However, I constantly run into ImportErrors when using Flask-security in combination with Blueprints, so I decided to go a different way. Thanks anyway!
@Rapidodalua2008
@Rapidodalua2008 6 лет назад
Is it possible to create a Playlist for all your Flask-Login related stuff? And how should we follow up, it would be much appreciated!
@prettyprinted
@prettyprinted 6 лет назад
I'm thinking of ways to make the playlists more organized here. There are limits to RU-vid playlists, so I may have to put together something on my website.
@mitaanshuagarwal007
@mitaanshuagarwal007 6 лет назад
Thank you! You are amazing!
@prettyprinted
@prettyprinted 6 лет назад
You're welcome! Thanks for watching.
@vinsmokearifka
@vinsmokearifka 6 лет назад
thank you anthony
@prettyprinted
@prettyprinted 6 лет назад
You're welcome.
@dennisasamoah2213
@dennisasamoah2213 4 года назад
please how do i use the flask login without sqlAlchemy , but with the the traditional database ; HELP ME
@RobertMagier
@RobertMagier 6 лет назад
Gold :)
@jasper5016
@jasper5016 6 лет назад
Awesome. You got Thumbs up and new subscriber.
@prettyprinted
@prettyprinted 6 лет назад
Thanks, I appreciate it!
@martiny1785
@martiny1785 4 года назад
How is user_id in the load_user function not equal to none?? Because when i put the int() before the user_id it gives me a ValueError invalid literal for int() with base 10: 'None''
@peterjohnson6439
@peterjohnson6439 6 лет назад
In the video, and I am not sure if you will address this in further videos yet, when you are calling a list of users for the usernames what do you do in that case? Is there a video that covers pulling names from this list rather than just the one name? Or do you have to list each of the usernames?
@prettyprinted
@prettyprinted 6 лет назад
I'm not sure what you mean. Why would you want to use a list of users for login functionality. it should only be one user at a time.
@docetes
@docetes 7 лет назад
love the vids! When is the next one due out :)
@prettyprinted
@prettyprinted 7 лет назад
Thanks! i plan on recording the next video today. I lost my voice last week.
@piyushvikasduta
@piyushvikasduta 3 года назад
How to customise and put `username` instead of `id` in get_id() method inside flask_login
@espenkl
@espenkl 6 лет назад
Hi, great video. One question, does Flask-Login make the session secure? Or what to add to make the session secure? If i use a form, is it then to apply Csrf protection to the form?
@prettyprinted
@prettyprinted 6 лет назад
The session is secure, but the CSRF token is something different. You'll have to add that to the form yourself.
@vinnnnnny12345
@vinnnnnny12345 7 лет назад
im stuck at 6:37. my application is call finalProject and i run from finalProject import db but got the error: ImportError: No module named flask_login any help would be appreciated
@prettyprinted
@prettyprinted 7 лет назад
Did you install flask login using pip? pip install flask-login
@vinnnnnny12345
@vinnnnnny12345 7 лет назад
Pretty Printed yes, what was wrong was that I needed to get the latest version of pip
@sagarpanwar69
@sagarpanwar69 4 года назад
what if i have a environment databse url , then what to use in plde of db.model in user class
@Kevinschart
@Kevinschart 7 лет назад
In your tutorials you put a lot of code in the flask views file. In a more production ready app would most of the computation be done by functions saved in a separate module?
@prettyprinted
@prettyprinted 7 лет назад
Yeah, it's easier to have all the code in one file for my RU-vid videos. For production apps, you'd be better off separating them if you have a lot of code. I have a video on one way to do it here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-_5OXmXvkU_E.html There are plenty of other ways to do it though.
@HimanshuBansal2089
@HimanshuBansal2089 7 лет назад
Great tutorial, My only question is there a cleaner way to apply 'login_required' on multiple methods or i have to decorate every method that requires user login??
@prettyprinted
@prettyprinted 7 лет назад
Yes, you can use class-based views and then apply the decorator once in the class. See here: flask.pocoo.org/docs/0.12/views/
@HimanshuBansal2089
@HimanshuBansal2089 7 лет назад
thanks for the solution, i have been searching this for long time
@jasper5016
@jasper5016 6 лет назад
Is it doing anything other than session handling? I dont find flask-login very useful.
@prettyprinted
@prettyprinted 6 лет назад
Just session handling. Check out Flask-User or Flask-Security if you want more.
@yhhsteven
@yhhsteven 7 лет назад
What was the program you used for running Python script, the orange icon one?
@prettyprinted
@prettyprinted 7 лет назад
It's Bash on Windows so you can use Ubuntu inside of Windows.
@sahanabadri5877
@sahanabadri5877 6 лет назад
How to use Flask-login using pymongo? Do you have any videos on it?
@prettyprinted
@prettyprinted 6 лет назад
You'll have to write query in the user load to get your user with pymongo. I don't have any videos on it, but perhaps I'll create one.
@SadSadDeadM
@SadSadDeadM 7 лет назад
When I try to display user username I get info that I'm anonymous user that has no attribute as username. Also I get warning "Unauthorized" when I try to enter a page after logging in
@prettyprinted
@prettyprinted 7 лет назад
Check your cookies. Is the app creating one when you log in?
@slinbody
@slinbody 6 лет назад
How can I handle the "Unauthorized" Page by myself ? For example, I want to custom the words. Thank you.
@slinbody
@slinbody 6 лет назад
login_manager.unauthorized_handler
@prettyprinted
@prettyprinted 6 лет назад
USER_UNAUTHENTICATED_ENDPOINT configuration value.
@chrislam1341
@chrislam1341 4 года назад
the official documentation argues we MUST include the 'next' algo, see the following, after successful login next = flask.request.args.get('next') if not is_safe_url(next): return flask.abort(400) could you please explain why is it necessary? Thanks. here is the reference: flask-login.readthedocs.io/en/latest/#flask_login.LoginManager.user_loader
@ZeroRegretz
@ZeroRegretz 5 лет назад
Are you on ubuntu or windows? I'm confused.
@prettyprinted
@prettyprinted 5 лет назад
Both! You can use Ubuntu on Windows.
@shivamkapoor1827
@shivamkapoor1827 5 лет назад
If we not inharrit from usermixin then we can use login_user (user) and logout_user () function or not?
@prettyprinted
@prettyprinted 5 лет назад
The UserMixin makes it easy for Flask Login to know what represents a user. If you don't have that then you'll need to create your own methods so you can use login_user.
@timothypulliam2177
@timothypulliam2177 7 лет назад
I get "Class "User" has no "query" member". I have all of the the necessary packages.
@prettyprinted
@prettyprinted 7 лет назад
Do you have the db.Model in the class declaration? class User(UserMixin, db.Model)
@timothypulliam2177
@timothypulliam2177 7 лет назад
Thank you so much for responding. Yes. I have my code in an __init__.py file. ideone.com/JcZFrQ And here is my requirements.txt file, which I have installed PIP packages using virtualenv from. pastebin.com/rPpprzHk The error occurs at the line "return User.query.get(int(user_id))"
@timothypulliam2177
@timothypulliam2177 7 лет назад
Nevermind. It seems to be working despite this error. I'm not sure why I'm getting the error but it is not a runtime error.
@mayurpande5415
@mayurpande5415 7 лет назад
I have an external database that I am connected through pypyodcs, would I need to still need to make a user class in the same way you have, as all I want to do is check if the user is logged in, if they are get them to enter there credentials and check against the mssql database.
@prettyprinted
@prettyprinted 7 лет назад
Yeah, you'll need a user class and a user loader. This is so Flask-Login can map sessions to actual users in your database. It doesn't have to be like a SQLAlchemy class though, where it has all the table information.
@mayurpande5415
@mayurpande5415 7 лет назад
ah ok think I got you. So you mean within my user class, I can use a try-except to connect to my mssql db using pypyodbc connector, then from there I can use those credentials to check if the user is logged in or not, am I on the right track? Also is there a way to obtain the user details if logged in, as I need to pass the user details in a post request to an api. Thanks for the help
@prettyprinted
@prettyprinted 7 лет назад
You don't necessarily need to connect to your database using the user class directly. The user class should just represent a user. The user loader should be a little more direct to your database though, so you can query the database for a particular user given an ID.
@mayurpande5415
@mayurpande5415 7 лет назад
Ok can I use the email address as an id? As I don't have any other id in the user table, well there is but it is a crazy long hexnumber I think! I didn't create the table! I'm still a noob, the head developer at my work did
@prettyprinted
@prettyprinted 7 лет назад
Yeah, an email address is fine as an ID. The ID just has to be unique.
@faresgeek-dz5692
@faresgeek-dz5692 7 лет назад
how to ude materialize.css with flask or django?????
@prettyprinted
@prettyprinted 7 лет назад
There's a Flask plugin called Flask-Materialize. It's similar to Flask-Bootstrap, which I have videos on.
@faresgeek-dz5692
@faresgeek-dz5692 7 лет назад
Pretty Printed thank you ..you are great...any django videos in futur??
@prettyprinted
@prettyprinted 7 лет назад
Yeah, I'm planning on making them soon. I want to finish up a Flask course first though.
@faresgeek-dz5692
@faresgeek-dz5692 7 лет назад
Pretty Printed thank you😀😀
@coop4476
@coop4476 4 года назад
sqlite:/// not sqlite:////
@naheliegend5222
@naheliegend5222 3 года назад
u lost me after 2 minutes...
Далее
More on Flask-Login
21:08
Просмотров 12 тыс.
🔒 Flask Login: авторизация
29:30
Просмотров 44 тыс.
skibidi toilet multiverse 042 Trailer
01:57
Просмотров 3 млн
Intro to Flask-Security
22:49
Просмотров 39 тыс.
How to Use Flask-SQLAlchemy With Flask Blueprints
20:10
Building a Blog App With Flask and Flask-SQLAlchemy
57:24
Solving one of PostgreSQL's biggest weaknesses.
17:12
Просмотров 198 тыс.
Web Forms With WTF! - Flask Fridays #5
22:56
Просмотров 69 тыс.
Session and Cookies explained with Python Flask Server
16:58
Intro to Flask-Admin
15:00
Просмотров 17 тыс.