Sir I need some help ...when I am providing the username and password its show invalid username and password again and again it is not getting restrict to dashboard.....page. While all thing thing is working well.
OperationalError: (sqlite3.OperationalError) no such table: user [SQL: INSERT INTO user (username, email, password) VALUES (?, ?, ?)] [parameters: (u'Macilaci', u'xxxx@gmail.com', 'sha256$b3KQePmY$9a764718353b18eed8c3474f3ceae86ee915444c7c8fb77997818b9460515512')] (Background on this error at: sqlalche.me/e/e3q8) :( The database is exist, iam followed your method. Why ???
Amazing video! Covered a ton and demonstrated everything really well. I've been looking for an example using SQLAlchemy, WTForms, Flask-Bootstrap, Flask-Login for quite some time
Actually I had to deploy my website using heroku and I am using sqlite and sqlalchemy , so I want to ask , jo hmara database hai yha pr vo local server pe store hota hain ya remote server pe for example inhone jo website bnayi hain simple login and registeration agr hm ise host kr de using heroku to database kha store hoga?
Hey man, I can see that all html templates inherit from bootstrap/base.html but I can see this particular file nowhere. Where does this come from ? And 2nd question, what's the purpose of importing bootstrap/wtf.html in the file ? Great tutorial by the way ! Thank you
Thank you so much for this video! Been looking for this exact thing and have only just found it. One thing I would suggest is having a requirements.txt in the github repo that way you can just import all the needed dependencies right from the get go :)
This is just vow! So much covered in such a short time. Really just what I needed and most other python developers who want to be able to create a webapp with these must have and important features.
GUYS!! update for who is not working!! copy the code below is your login is not working ------------------------------------------------------------------------- class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(15), unique=True) email = db.Column(db.String(50), unique=True) password = db.Column(db.String(80))
I don't think you created an area in sign_up() where you checked if the user/email already existed in the database so the creation of a new user would be rejected and they would have to input different information. If you did could someone direct me to that point in the video?
Thank you for such a great video! It's just awesome! I was so upset because I started doing something with flask and I couldn't make all the modules play together. But after your video I feel a lot better, and of course it's just a perfect implementation of the such a hard tutorial! I wish I could buy a course, I think it's something amazing! Again, Thank you so much!
Rly nice content Anthony. I watched a lot of other stuff, but yours is one of the best. Watch his Flask Course. 49$ is rly nothing. I had a python course for 2499$ and it was not worth it.
not sure why but I'm not able see error messages after the fields. Am I missing anything in newer version of WTForms?? if I inspect I have the error div tag with invalid-feedback class, it has display none. so my understanding is WTForms should take care of display right?? any help will be great.
Werkzeug already uses a salt when hashing the password: werkzeug.pocoo.org/docs/0.11/utils/#module-werkzeug.security I do recommend making things as secure as you are willing to though.
I need ur help, I've been making a project for U. Im using the check_password_hash, it converts my password and everything is fine but when I go to enter it gives me an invalid username or password, I would appreciate your help
Hi im sorry to bother you but im having a minor issue at 14:35 (Testing login form submit) Form is identical to your github as i submit it it gives me this error TypeError: __init__() takes at most 2 arguments (3 given) and this seems to happen at if form.validate_on_submit(): i changed it to see what data is being passed from my form and this is what i get {'username': u'username', 'csrf_token': u'Ijk1NjYxZmI1NTk1MzE0NmY4NzM4NWIyNjVhNjI2MDJiMjQxZWM0NzAi.C_cuBQ.ApYdhQeaiRi3SLacZbuzKhVqpWo', 'password': u'secretsecret', 'remember': False} im pretty sure code is identical but it doesnt seem to perform same way.
Curious. This content is 2 years old now. What's the current best practice? I've seen single sign on systems that work with Gmail/Facebook etc. (Could not get them to work) so what to do??
If i want to implement that @loginrequired functionality then what is the other way to do . Should i have to maintain a session in order to achieve that functionality ? Please i need your reply for once.
I constantly get an error when i try from app import db - says no module named 'app'. I am running this python from the base of my IntelliJ project. This is in Windows. Any help appreciated.
Great video as always! How do you use previously stored data in db for the dashboard? Would you add in another query in the login route to grab the personalized data and then send it back to the dashboard template before the redirect?
When I enter email id in signup form and after submitting it i'm getting an " AttributeError: 'Nonetype' object has no attribute 'EmailNotValidError'". Please help me to solve this problem?
Thanks for the videos! Could you keep posting new videos weekly? I think it's great if you could share some more tips & tricks on your experience of using flask at work?
Great video! Do you suggest that I write out all this code every time I make a new app or should I just type it all out one time and keep it on github so I could pull it when I need it for my next site?
Both are important, and you want to understand it well enough to be able to produce it yourself. But once you do understand it, there's no reason to rewrite it from scratch every single time.
Thank you! And I met some error when I try this.When "return User.query.get(int(user_id))",it shows that "NotImplementedError: No 'id' attribute - override 'get_id'". I searcher the Internet,and I found that "login_user calls get_id on the user instance".I use "user_id" instead of "id" in class User, so it can't find id. I solved this by overriding get_id to return user_id in class User. Hope it can help people who meet the same error. (Not native speaker of English, if I express clearly?)
Thanks for this amazing video on login via Flask and explaining step by step throughout the video. I followed your steps until the login page and I am stuck on the part where you check if username and password is taken by the login form. When I hit sign in, it doesn't redirect me to display my username and password. Can you please help me out.
I had the same error. I put this code in my template to debug it: {% if form.errors %} {{ form.errors }} {% endif %} So finally my error was that I was not following the correct length for the username or password (username -> Length(min=4, max=15), password -> Length(min=8, max=80) )
Just cannot get the user table to work in sqlite. I can see it is there and been created but when I enter the info in the signup page it says table does not exists. Anyone else had this?
Really great video, There is just one concept that i haven't quite get through. And that the difference between this type of generating user login and the use of sessions. If you could explain this it would be of great help. Thanks again for an exelent video
Thank for the video! I'm looking now for how to organize user permission? I've seen two of them available - Flask-User and Flask-Principal. What do you think is better?(Or maybe combine them?)
Make sure that when you are using sqlite3, it's the absolute path of the database you're using. for example: >>> sqlite3 C:\User\your-user\login-system\database.db I did that and it worked.
I have @login_required under my route for my 'dashboard' calling it 'home' instead but I can still access the home page without logging in? Any one know how to resolve this issue?
TypeError: hidden_tag() missing 1 required positional argument: 'self' The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object What should I do??
Thank you very much for this video. I had one doubt: if a user signs up once again with the credentials with which he has already signed up once, the program shows up an error on the browser. How can we render a custom HTML web page if the user tries to sign up with the same credentials again?
I didn't run into this issue because in my Registration form, I defined a "is_unique_username' and used that function on the form data in the register view to make sure the username is unique. If it isn't unique, I just have a flashed message "username taken'. Hope this helps.
Join my free course on the basics of Flask-SQLAlchemy: prettyprinted.com/flasksql
Sir I need some help ...when I am providing the username and password its show invalid username and password again and again it is not getting restrict to dashboard.....page.
While all thing thing is working well.
@@AvdheshkrSingh reregister with a new id. if it still doesnt let you check your database connection and user details validation logic
OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: INSERT INTO user (username, email, password) VALUES (?, ?, ?)]
[parameters: (u'Macilaci', u'xxxx@gmail.com', 'sha256$b3KQePmY$9a764718353b18eed8c3474f3ceae86ee915444c7c8fb77997818b9460515512')]
(Background on this error at: sqlalche.me/e/e3q8) :( The database is exist, iam followed your method. Why ???
@@AvdheshkrSingh Do you have the answer?
Thanks for watching everyone. Check out prettyprinted.com for Flask courses.
This video was suggested to us by our professor. Thank you so much!
Thank you very much! Been looking for something like this for three days! Everything I need is here!
Anthony, you're an excellent teacher!
Thx for the clearest explanations.
Thanks for the compliment!
Thanks for watching my videos.
I just want to say thank you. These videos are simply top notch.
You're welcome! Thanks for taking the time to watch.
This just saved my school project. You're an awesome tutor! Thank you so much!!!
I've already got some project in my job, You channel is really helpful. Thank You so much bro :)
Thanks for watching!
Awesome tutorial, I have been crawling along trying to put together this particular set of functionality. This is an excellent piece
Thanks for watching!
Thanks so much bud! I learned a ton of what I was missing after spending days on this.
Amazing video! Covered a ton and demonstrated everything really well. I've been looking for an example using SQLAlchemy, WTForms, Flask-Bootstrap, Flask-Login for quite some time
I'm glad you found it useful!
Great tutorial! I was able to follow along easily and use this to build my application and I feel like I have a good understanding of Flask!
That is hands down the most awesome and easy tutorial I have ever seen. Thank you for this tutorial!
This is most recent comments
I want to know is it still working
Please let me know
@@srishtijaiswal7079 I last used this tutorial in November 2021. It was working fine.
Actually I had to deploy my website using heroku and I am using sqlite and sqlalchemy , so I want to ask , jo hmara database hai yha pr vo local server pe store hota hain ya remote server pe for example inhone jo website bnayi hain simple login and registeration agr hm ise host kr de using heroku to database kha store hoga?
Another fantastic intro. Thanks Anthony!
Thanks, I appreciate it!
Best coverage on the topics, very through and practical
Thanks for watching!
Suspense screen when deleting the data hahaha. Awesome video bro, it's clarify me a lot!
Hey man, I can see that all html templates inherit from bootstrap/base.html but I can see this particular file nowhere. Where does this come from ? And 2nd question, what's the purpose of importing bootstrap/wtf.html in the file ?
Great tutorial by the way !
Thank you
Exactly my question.
I need to know this too
Finally i got what i was looking for. Thanks a lot for saving my day. I owe you one.
I'm glad I could help! Thanks for watching.
This video just saved me a few days of research. How can I donate to your beer/pizza fund?
I'm glad it helped!
You can buy one of my courses whenever I finally release one. Give me a few years.
Open a patreon page or something.
I just saw my old comment.
I have one premium course now on prettyprinted.com
I plan on release a couple in the coming month as well.
Thank you Anthony. It was an awesome video
Thank you so much for this video! Been looking for this exact thing and have only just found it.
One thing I would suggest is having a requirements.txt in the github repo that way you can just import all the needed dependencies right from the get go :)
Yeah, I'll start doing that.
Thanks for watching.
This is just vow! So much covered in such a short time. Really just what I needed and most other python developers who want to be able to create a webapp with these must have and important features.
I'm glad you like it!
i cant use sqlite3 as its not recognized as an internal or external command
love that you're using ubuntu under the hood. Been using it a ton myself in Win10... Makes things much more bearable :-)
Yeah, it's great. I love not having to dual-boot.
thank you so much for this project ..more power to this channel
Excellent video bro. Thanks.
GUYS!!
update for who is not working!!
copy the code below is your login is not working
-------------------------------------------------------------------------
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(15), unique=True)
email = db.Column(db.String(50), unique=True)
password = db.Column(db.String(80))
You got me out of a dark place.....great stuff
I'm glad the video helped. Thanks for watching!
Great video!! Thank you very much! You are doing an awesome work
You're welcome! Thanks for watching.
Exactly what I need for my project. Great job!
Perfect timing!
Thanks for watching.
I'm from Indonesia. And i'am love it !
I don't think you created an area in sign_up() where you checked if the user/email already existed in the database so the creation of a new user would be rejected and they would have to input different information. If you did could someone direct me to that point in the video?
Thank you for such a great video! It's just awesome! I was so upset because I started doing something with flask and I couldn't make all the modules play together. But after your video I feel a lot better, and of course it's just a perfect implementation of the such a hard tutorial! I wish I could buy a course, I think it's something amazing! Again, Thank you so much!
Hey Oleg, I'm glad the video was able to help you!
I do sell courses on prettyprinted.com You can check them out there if you're interested.
Pretty Printed I also interested, do you do all this project( "Pretty Printed) by yourself, or you have a team?
Until recently it was just me, but I just hired someone to help me with video production.
Rly nice content Anthony. I watched a lot of other stuff, but yours is one of the best. Watch his Flask Course. 49$ is rly nothing. I had a python course for 2499$ and it was not worth it.
@Pretty Printed do you use DVORAK, though?
Really perfect !!! Thanks a lot.
Awesome man, thanks for that!!
not sure why but I'm not able see error messages after the fields. Am I missing anything in newer version of WTForms??
if I inspect I have the error div tag with invalid-feedback class, it has display none. so my understanding is WTForms should take care of display right?? any help will be great.
Great tutorial! Thank you!!
thank you so much Anthony! great tutorial.
Great intro. Do you think that it would be good to use a password seed to help further obscure the password, and does that library support it?
Werkzeug already uses a salt when hashing the password:
werkzeug.pocoo.org/docs/0.11/utils/#module-werkzeug.security
I do recommend making things as secure as you are willing to though.
bcrypt is good for this!
Thanks for this course
Thanks for this tutorial
Is a great resource. I hope to watch more videos about Python.
Hi,
It seems that the user class isn't being added to the database. When I search for it with the '.tables' line, 'users' isn't there. Any idea why?
Why dont you use submit button from the wtform?
I need ur help, I've been making a project for U. Im using the check_password_hash, it converts my password and everything is fine but when I go to enter it gives me an invalid username or password,
I would appreciate your help
Can you show us how to update/change a password for an existing account? Thanks!
Im trying to validate username with jquery n ajax, but getting error while trying to get username before WTForm submit, how to get username value?
Awsome video . For a complete beginner in python this is helping alot. Thank you.
You're welcome. Thanks for watching!
Hi im sorry to bother you but im having a minor issue at 14:35 (Testing login form submit)
Form is identical to your github
as i submit it it gives me this error
TypeError: __init__() takes at most 2 arguments (3 given)
and this seems to happen at
if form.validate_on_submit():
i changed it to see what data is being passed from my form and this is what i get
{'username': u'username', 'csrf_token': u'Ijk1NjYxZmI1NTk1MzE0NmY4NzM4NWIyNjVhNjI2MDJiMjQxZWM0NzAi.C_cuBQ.ApYdhQeaiRi3SLacZbuzKhVqpWo', 'password': u'secretsecret', 'remember': False}
im pretty sure code is identical but it doesnt seem to perform same way.
It's hard to know without seeing the code you have. You can email me at anthony@prettyprinted.com and I can take a look.
Hi Anthony, I keep getting an error saying wtf is not defined in my signup.html, I have flask-bootstrap installed, what could be the reason?
Curious. This content is 2 years old now. What's the current best practice?
I've seen single sign on systems that work with Gmail/Facebook etc. (Could not get them to work) so what to do??
If you want to use usernames and passwords, then something like this is still a good start. I'll cover single sign on more in the future though.
How you are able to run??I mean how u r using it on the server??
Video is created very well. Can you also share which tools did you use to create this youtube video?
I used Movavi Screen Capture Studio.
If i want to implement that @loginrequired functionality then what is the other way to do . Should i have to maintain a session in order to achieve that functionality ? Please i need your reply for once.
well explained...thank you.
Does the @login_required actually work on a server (not localhost) ? I am randomly losing the session and being redirected to the login page.
Thanks, Pretty Printed! Awsome tutorial!
You're welcome! Thanks for watching.
I constantly get an error when i try from app import db - says no module named 'app'. I am running this python from the base of my IntelliJ project. This is in Windows. Any help appreciated.
Thank you so much. Your channel is awesome.
You're welcome!
Can i use python storage (shelve) in this for user login ? and if so , is it still the same steps ?
Great tutorial as always from you
Thanks!
how do I put sql server in 'SQLALCHEMY_DATABSE_URI' ?
The best tutorial
Great video !!!
Great video as always! How do you use previously stored data in db for the dashboard? Would you add in another query in the login route to grab the personalized data and then send it back to the dashboard template before the redirect?
I would query for the data in the same route that has the dashboard template. Then just pass the data to the template.
When I enter email id in signup form and after submitting it i'm getting an " AttributeError: 'Nonetype' object has no attribute 'EmailNotValidError'". Please help me to solve this problem?
Thanks for the videos! Could you keep posting new videos weekly? I think it's great if you could share some more tips & tricks on your experience of using flask at work?
I'm working on expanding Pretty Printed in other ways, but I do want to get back to posting multiple videos per week soon.
Never mind man, i fixed it :D thanks again.
Great video. Is there a way to create it using local bootstrap files instead which would be located in the static folder?
Yes, you just add the files to your static folder and then add them to your link and script tags in the template using url_for.
"Install 'email_validator' for email validation support" i am getting this error
Great video! Do you suggest that I write out all this code every time I make a new app or should I just type it all out one time and keep it on github so I could pull it when I need it for my next site?
If it works for you, keeping it in Github as a base for each new project will save you a ton of time.
So to recap: pulling it and configuring it is more important to get this down by memory?
Both are important, and you want to understand it well enough to be able to produce it yourself. But once you do understand it, there's no reason to rewrite it from scratch every single time.
This is good, but to use this video we need templates, e.g. login.html, how can we get this file?
Many thanks. Really very helpful.. I am new to flask. Can you suggest how to generate the secret key?
You can use the os module.
import os
app.config['SECRET_KEY'] = os.urandom(24)
FYI for the new people when doing the app.config['SQLALCHEMY_DATABASE_URI'], make sue to add 3 not 4 '/' its changed
Thank you!
And I met some error when I try this.When "return User.query.get(int(user_id))",it shows that "NotImplementedError: No 'id' attribute - override 'get_id'".
I searcher the Internet,and I found that "login_user calls get_id on the user instance".I use "user_id" instead of "id" in class User, so it can't find id.
I solved this by overriding get_id to return user_id in class User.
Hope it can help people who meet the same error.
(Not native speaker of English, if I express clearly?)
Thx a lot ! simple and clear explanations
You're welcome. Thanks for watching.
Thanks for making this!
Thanks for this amazing video on login via Flask and explaining step by step throughout the video. I followed your steps until the login page and I am stuck on the part where you check if username and password is taken by the login form. When I hit sign in, it doesn't redirect me to display my username and password. Can you please help me out.
I had the same error. I put this code in my template to debug it:
{% if form.errors %}
{{ form.errors }}
{% endif %}
So finally my error was that I was not following the correct length for the username or password (username -> Length(min=4, max=15), password -> Length(min=8, max=80) )
Another great tutorial. Thank you so much!
You're welcome! Thanks for watching.
Just cannot get the user table to work in sqlite. I can see it is there and been created but when I enter the info in the signup page it says table does not exists. Anyone else had this?
Yes. I have, same problem. Are you fix that yet? Can you help me?
Great, complete, very well explained tutorial. Keep up the good work!
How do I query for Username and Email when Logging In???
jinja2.exceptions.TemplateNotFound: bootstrap/base.html
I got this error, I really cant find the base html
I have resolved , I had to install Flask Bootstrap
Really great video, There is just one concept that i haven't quite get through. And that the difference between this type of generating user login and the use of sessions. If you could explain this it would be of great help. Thanks again for an exelent video
ayo, do u have an updated video on this???
thanks for your tutorial!!!!!!!!!!!!!!
Thank for the video! I'm looking now for how to organize user permission? I've seen two of them available - Flask-User and Flask-Principal. What do you think is better?(Or maybe combine them?)
Flask-User will probably be easier to use for your purposes.
where is the database?
someone, please help me out here, I'm pretty much on track, but my login is not showing everything I'm returning.
very nice tutorial...amazing video
Thanks for watching!
Hello, I have created User class and when done db.create_all() but in sqlite when i type .tables -- no tables are there, what could be the reason
Make sure that when you are using sqlite3, it's the absolute path of the database you're using.
for example:
>>> sqlite3 C:\User\your-user\login-system\database.db
I did that and it worked.
how to make dashboard.html ? and how if we download dashboard template and put in flask ?
Awesome man
I have @login_required under my route for my 'dashboard' calling it 'home' instead but I can still access the home page without logging in? Any one know how to resolve this issue?
TypeError: hidden_tag() missing 1 required positional argument: 'self'
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
What should I do??
Any way to get login.html?
could you please add forgot password feature
life savior, keep it up
Thanks for watching!
Great! How to build this as an crud system where an admin can create and delete users and user have their own restricties area?
The easiest way would be to use Flask-Admin, which I already have videos on.
Thank you very much for this video. I had one doubt: if a user signs up once again with the credentials with which he has already signed up once, the program shows up an error on the browser. How can we render a custom HTML web page if the user tries to sign up with the same credentials again?
I didn't run into this issue because in my Registration form, I defined a "is_unique_username' and used that function on the form data in the register view to make sure the username is unique. If it isn't unique, I just have a flashed message "username taken'. Hope this helps.