I wasted thousands of dollars in college and learned nothing compared to what i learned here in this channel for free. You guys are amazing . You people deserve a noble prize for what you are doing here.
Please, don't apologize for a long video when it is fast paced and full of good stuff like this! Flask can be a little inscrutable sometimes, and I really appreciate that this tutorial went from zero to functional in one go. Bravo!
So true like Tim istg why are you apologizing?😭😭 Ur the one giving us gr8 content the longer just means you did more effort explaining it which we love obviously 😭
@@preattogaming1533 I'd have to see the error, but import errors are usually because you haven't installed the module you are trying to import. "Pip install" the module first!
I won't lie, this is the most worth video on TH-cam that I have ever seen in my entire lifetime! Your videos are the best, without doubt. Thank you for helping everyone by making everything simpler than all the other teachers on TH-cam.
Tim... We can't thank you enough for this tutorial! I can't put it in words how much this tutorial helped me to finally start progressing with Python programming! I know, for you this is simple, however, for beginners like me, this tutorial is like finding a bag of gold. Thank you!
To those of you that have just landed on this video. This is one of the best videos I have ever watched. For me, it covered everything I wanted to learn in one simple to understand package. Thank you Tim.
im still not past the changing interpreters part. no matter which interpreter i choose i still keep getting the module error not found. i have been stuck on this for 4 days with no where to turn and no question being answered or any answer of help.
I was doing a project and I was frustrated and scared because I was sure I could not do it. But following this tutorial gave me confidence and I finally did it! It was so helpful and easy to follow. Thank you so much Tim!!
I got to say that as a beginner with 3 days learning python, I can't understand most of the the code you did but you gave me courage to continue what I'm doing
Python, like all skills, takes a lot of time. Stick with it, and remember that no programmer knows it all. You can build some of the most complex systems on earth, but you'll still need Google from time to time. Good luck!
@@AhoyCapnLinux thanks for this reply, but as for now I was building a calculator with tkinter. And your reply thought me that it really takes more time and practice. I never knew that people like you have interest to help me. Thanks men
This video changed my life! Everything I needed right now was someone that carefully explained how to create a python-based website and you helped a lot. I recommend to people that are watching the video for the first time to open the git code because on the comments there are a lot of tips and updates of parts that are deprecated. Anyway, helped a lot, you spoke clearly and was straight to the point, explaining what was needed and the basic concepts surrounding. I could even replicate with similar purposes and hope to expand even further now. Really appreciate the video.
I can't think of anyone who I'd rather listen to for more than two hours straight, explaining code to me lol, I love this. very pleasant voice and character, very well done. Thank you so much!
Excellent video! 😄😄 This project is so nice to begin with Flask and Python for web - User authorization and authentication - Databases - Creating servers with Flask - Using variables, loops, if sentences - Using HTML templates Thank you so much! 😄👍
I just watched and coded simultaneously with Tim... The only thing I couldnt manage to learn "What" Bracketss!? Keep up bro Im coding with you for 2 years now.
For those how come to the comment session with create_all() to create database error 1:33:45. As per the new version, this is the fix: def create_database(app): if not path.exists('website/'+ DB_NAME): with app.app_context(): db.create_all() print("Created Database!") Thanks for the video. @TechWithTim
Thanks man! I too got the same error and applied this same piece of code to debug it. But I ran into another error while creating users for the signup page. I did exactly what he did, but the error says ValueError: Invalid hash method 'sha256'.
bro i ran the whole thing yesterday and it was working all good but today when i tried to run it has all sorts of errors and my envn has been set to production return self.wsgi_app(environ, start_response) this types of errors occured could you help
Excellent tutorial Tim. I watched many others on Flask and got no clue. After watching yours, just realised Flask is around 90% of what I already knew on front-end coding with PHP
@@Eric-dd8bk Was thinking of making a personal website (about my programming projects). Ended up starting it in Golang as I didn't need databases and login stuff, but still great video.
Just to let other viewers know, the jenga scripts are now outdated and the code will not work anymore. Check the documentation for updated scripts that work. Other than that, great video!
This is the best instructional video for programming I have ever seen! Also, if the small errors were deliberate (as I suspect), this makes it all the more effective as it shows troubleshooting as well.. Absolutely fantastic !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I love that you leave in typos and errors because I usually try to correct them myself to make sure that I'm understanding well. It's also nice to have all those modules to look into. it saves up the time of searching everywhere for interesting modules and plugins (so you get more time to practice them !) Also, the additional stuff like the version import methods are super interesting. Now I want to redo it myself and create my portfolio website for my programming projects. Thanks man I'm learning programming on the side with a full time job, your videos make it fun and practical.
I'm trying to build a flask crud website currently and I'm strugling heavily with the one to many relationship in my database. I reaalllyy hope this video will cover it but judging from the 5 minutes I've seen so far I can tell even if my specific issue isn't covered there's going to be a lot for me to learn from watching you.
I really like that you keep your mistakes in the video, even the 'simple' things like relative importing. It definitely humanises you and makes you more relatable. It's a nice reminder that coding is hard and we're not doing simple things here.
Great video! Consice yet precise. One note here for those who want to take this project to the next level: You may use WTForms for flask to create forms more elegantly. It will also help you to modulerize you app.
Really helpful Tim! The only part I would like you to update about is that the 'db.create_all(app=app)' method is obsolete in the latest version of flask-sqlalchemy. Instead we now need to us a 'with app.app_context():' to use 'db.create_all()'. Also in my PC, the new database is created in a new folder called 'instance' by default using the same code as yours. It would be great if you could explain why that happens.
Hi, this might be a bit late, but if you want your db file to be placed on the website folder, you need to specify the full path in the SQL_ALCHEMY_URL configuration. app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{path.join(app.root_path, DB_NAME)}'
Just a small note, SQLalchemy no longer accepts 'app' in create_db(), but the code has been simplified and no longer requires a function to complete the same task. Cheers!
I was in these muddy waters for the past half an hour while watching corey's old videos, man. Figured out it must be because the libraries got updated but couldn't manage to find a way since. Would love it if you elaborate!
@@metalskull8687 I've been confused about the same thing, and I can't give you a good explanation of how to solve this but if you uninstall flask-sql alchemy and reinstall it as the older version, flask-sqlalchemy==2.5.1 it should work. Hope this helps.
1:33:40 in the video when he's having the import problem, I think what he meant to say or do was: from . import models because that's what I did, for everyone else using this blueprint to add more classes other than user and notes. Also if you're having the missing module SQL alchemy and/or flask login just go to your terminal and install both modules. I ran into those errors even though I installed flask it didn't come with everything so to make it clear in your terminal type: pip install -U Flask-Login and/or pip install Flask-SQL-Alchemy Then everything should work fine. Also to add on at the 1:54:39 section when you are in the __init__.py and you're doing the whole login_manager.user_loader part. If you used the from. import models to optimize your code, you'll get an error cause User isn't defined with the code written in the video. You have to tell the computer User is from the models module like this. @login_manager.user_loader def load_user(id): return models.User.query.get(int(id)) not @login_manager.user_loader def load_user(id): return User.query.get(int(id)) like in the video. Just so you know. Hope this helps someone.
db = SQLAlchemy() def create_app(): app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///project.db" db.init_app(app) from . import models with app.app_context(): db.create_all() return app # There is no need for that create_database function. SQLAlchemy will already not overwrite an existing file, and the only time the database wouldn't be created is if it raised an error.
just want to mention, is very important to structure the project in the exact same way he has his folder (i got trouble because of that). Dude your explanation and tutorial is just amazing, thnx great way to introduce us in web dev with python and flask
i can't thank u enough for this,i was struggling for building the backend for my webpage for the mini project in college.Because of u i was able to complete the login page and signup,now i just have to link the url for previously build front end ,tysm
Thank you for making this! It was very simple to follow, and I love that I went from knowing nothing about flask to having a functioning website (also thank you for posting the code in the description, that was also very helpful). This was exactly what I was looking for!
Awesome stuff Tim! covers everything I typically need in Flask within a nice project. Also for the sake of simplicity, I like to flash the messages with categories equal to danger/success to match the bootstrap alert classes and the in the Jinja template, I show both types of messages in one loop like this {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %} {{ message }} ×
+1 for all the praise. It seems like every single guide I found on how to get started with Flask and any kind of web site integration for Python was all "buy this app" or "use our service" or totally glossed over critical starting point info so you had to already know how to set everything up and they just showed you some code afterward with no explanation of what parts of their starting point mattered and what didn't. As someone learning this on my own rather than through formal sources this was extremely helpful. I'll definitely be coming back to watch a lot more of your content as time permits.
If you are using the latest version of python and flask as of 9/1/24 you could encounter an error with sha256 not being recognized in the sign up function. replace sha256 with 'pbkdf2:sha256' and it should work
It took me a minute but I figured it out. Bootstrap 5 is slightly different. Without having to go into detail here I suggest that if anyone is using BS5 please read the documentation.
I have done frontend many times with HTML CSS and JavaScript, but it's my first time in backend programming the video was a good video and I really appreciate your handwork it was great feeling after finishing this project
23:00 I think If you are using VScode you can just write "!" at the beginning of the HTML file and a drop-down menu pops up and you can choose one of the items so VScode can auto-complete the framework for the HTML source code. I might be wrong though as I haven't really used VScode for a bit.
Btw if you're having problems with the "generate_password_hash()" function, idk since when but they changed the sha256 method to "scrypt". It's the same just with a different name. :)
I created my first app with your instructions.. Very clear precise and perfect. I followed along very well. Thanks man.. Even at 2yr old its still relevant i think..
Brilliant. I was about to be a chump and purchase a course online. However, this is better than most and for the amazing cost of free on TH-cam. Thanks a million times over and never change. You rule!
Tim I'm making a chat feature in my website. How do you add chat history based on the chat rooms? Could you please make a tutorial on that? Not many people make very reliable tutorials on chat apps and chat history for specific rooms. I have searched all over the web.
Doesn't sound hard, but your request is too specific, when you are trying to search how to resolve a problem like this, you need to divide the problem into sub-problems more: How are your chat rooms structured? With the structure you have right now, can you make this happen or do you need to modify it? So, for example, what is a chat history? it's basically a server-stored piece of text, nothing else. So if you are sending the messages from client to client, you'll need to first make that message go through a function that appends each message to the end of a string or file, now, how you structure the way to save the messages is up to you too: plain text or some sort of data structure so you have access to the user's id, msg, hour that it was sent, etc Start implementing the feature by resolving the now smaller problems (passing each message through a function, having where to save it, formatting it to your liking before saving, reading the chat history, etc) and when you get stuck, it will probably be something more general: Not "How to read a chat history from a database" But "How to get a field's content from a database" Or Not "How to make a function that saves chat messages into a file" But "How to append data to the end of a file"
Here’s the easy, lazy way 1. Look up how to make chat rooms using flask 2. Click the first result 3. Select the code 4. Ctrl+C then Ctrl+V on ur code editor. 5. Recompile and voila!
One video of how to build apis in Flask really helped me complete a Gig, where i had an intercom software with is back end as a flask api, thanks alot, you were my teacher as a beginner right now am what you can call a pro thanks bro.., all the best
Another error found is, when running your code in your browser, it might say 'templates not found: home.html' This is because, there's no folder imported to the '__init__.py' for lookup You might write in the '__init__.py' : from (name of your template parent folder. Mine was 'WEBSITE') So I got: from WEBSITE import templates Good to go🥰
A little correction in the __init__.py's last function: def create_database(app): with app.app_context(): if not path.exists('instance/' + DB_NAME): db.create_all() print('Created Database!')
@user-xb3rl5bv7c that is correct, but additionally change the path from 'website/' to 'instance/'. db seems to be automatically created at a different location
Hi ! I m following all your instructions from the start but it seems like i can t import either views or auth . An error mssg pop out (can t import name 'views" from 'website.views' whenever i try to import them in __init__.py file , thanks in advance and love your videos : )
Wow! Amazing video! Thank you so much! One quick typo at 1:07:43, it should say "alert-dismissable". Also, is there a much simpler way to add the delete note option? I got a bit lost with all the custom JS just for that simple function. Thank you again!
the only good programming tutorial ever, you are the first person to make a tutorial that doesn't treat the viewer like they are stupid. I wouldn't be watching this if I didn't already have at the very least a basic understanding of programming. Too many tutorials over explain the basics, when they should be telling you to go learn them first.
Start a high paying tech career making $60k+/year with NO DEBT: coursecareers.com/a/techwithtim?course=software-dev-fundamentals
Bro there r lots of Indians u hv help with this video, tomorrow they will come to steal ur jobs.
R u really ok with that.
but I don't know why I can open the link
jinja2.exceptions.TemplateNotFound: home.html plz help
s
I wasted thousands of dollars in college and learned nothing compared to what i learned here in this channel for free. You guys are amazing . You people deserve a noble prize for what you are doing here.
well, you could also learn something while in college, and not waste that much money
@@barmalini yeah so true
u didnt listen there then. ya hear? just kidding....
it's hard to land tech job without degree tho
Been stressing over a uni project for the past two months and came across this video, I literally want to cry. Thank you soooooooooooooo much!
me also
Does it worked well by following the same instructions given in the video?
Am in same case as you, please reply...
@@ancientist1846 hi
After signing up am getting error
Please, don't apologize for a long video when it is fast paced and full of good stuff like this!
Flask can be a little inscrutable sometimes, and I really appreciate that this tutorial went from zero to functional in one go. Bravo!
lol
So true like Tim istg why are you apologizing?😭😭 Ur the one giving us gr8 content the longer just means you did more effort explaining it which we love obviously 😭
I cant HEAR yOU>>!! OH...HELL>>>>YEAHHH
Bro can u help me out it's showing import error
@@preattogaming1533 I'd have to see the error, but import errors are usually because you haven't installed the module you are trying to import. "Pip install" the module first!
I won't lie, this is the most worth video on TH-cam that I have ever seen in my entire lifetime! Your videos are the best, without doubt. Thank you for helping everyone by making everything simpler than all the other teachers on TH-cam.
I don't understand why most youtubers seem to focus on front end. I think backend is so much more useful! Thanks for this Tim
This young man is an incredible tutor. He explains the concepts so clearly. Top notch, thanks Tim!
"This young is incredible" "WOW" WHAT lS That?????Is(is) vs ls(Ls)
Tim... We can't thank you enough for this tutorial! I can't put it in words how much this tutorial helped me to finally start progressing with Python programming! I know, for you this is simple, however, for beginners like me, this tutorial is like finding a bag of gold. Thank you!
Hey bro can you tell me one thing, what's back-end and front-end Language in this project.
Please answer me🥺
Speak for yourself
@@asadraza6146 no no no no noi!!!!
How to connect with sql server
@@armygstan9541 did you find the answer to your question bro?
To those of you that have just landed on this video.
This is one of the best videos I have ever watched.
For me, it covered everything I wanted to learn in one simple to understand package.
Thank you Tim.
im still not past the changing interpreters part. no matter which interpreter i choose i still keep getting the module error not found. i have been stuck on this for 4 days with no where to turn and no question being answered or any answer of help.
can u help me?
Min 28:13 he said to copy the thing
I didn't know from where bc my English isn't good can u help me?
@@LG-ut3hw check the description for the code used in the tutorial
@@louisgalluzzo9284 +1
@@louisgalluzzo9284 Stuck on the same issue did you find a solution yet?
You deserve a Nobel prize in virtual teaching, never seen a comprehensive guide as you done..easy to learn, explaining in detail... 🎉
Wow, thank you!
@@TechWithTim When I download VS 2022, it looks different and I can't make different folders within a project- what should I do?
@@SmurphofChaosdownload vs code not vs
@@gerardonavarro3400 tysm lol. Been stuck using Python IDLE this whole time lmao
I was doing a project and I was frustrated and scared because I was sure I could not do it. But following this tutorial gave me confidence and I finally did it! It was so helpful and easy to follow. Thank you so much Tim!!
ur welcome, sena
@@Ryan78900 John Sena
@@LotOFfactories hi John Seenah you’re my next gf
I got to say that as a beginner with 3 days learning python, I can't understand most of the the code you did but you gave me courage to continue what I'm doing
Python, like all skills, takes a lot of time. Stick with it, and remember that no programmer knows it all. You can build some of the most complex systems on earth, but you'll still need Google from time to time. Good luck!
@@AhoyCapnLinux thanks for this reply, but as for now I was building a calculator with tkinter. And your reply thought me that it really takes more time and practice. I never knew that people like you have interest to help me. Thanks men
@@waffleman9178 It's going to be quite the journey moving ahead, be sure not to lose faith and remember to always have fun! Happy coding!
@@justinwong833 aww.. thanks. I'm so amazed people spend their time replying on this comment just to help me and others.
@@waffleman9178 I hope you'd pay it forward in the future by helping other newer coders! Happy to see a new member join our community
No algoexpert, i don't what to become a software engineer at google.
Update: I entered computer science and now I am a senior 😂
So true
True
True
I have my own software startup that's not looking good...
This guy deserves and Nobel prize! So true! hats off!
This video changed my life! Everything I needed right now was someone that carefully explained how to create a python-based website and you helped a lot. I recommend to people that are watching the video for the first time to open the git code because on the comments there are a lot of tips and updates of parts that are deprecated. Anyway, helped a lot, you spoke clearly and was straight to the point, explaining what was needed and the basic concepts surrounding. I could even replicate with similar purposes and hope to expand even further now. Really appreciate the video.
I can't think of anyone who I'd rather listen to for more than two hours straight, explaining code to me lol, I love this. very pleasant voice and character, very well done. Thank you so much!
I had a question... do I need to be really well versed with python to go on with this video?
For earlier versions of Python (before 3.6): note = json.loads(request.data.decode('utf-8')) instead of note = json.loads(request.data)
I was wondering why the deleted section wasn't working
Excellent video! 😄😄
This project is so nice to begin with Flask and Python for web
- User authorization and authentication
- Databases
- Creating servers with Flask
- Using variables, loops, if sentences
- Using HTML templates
Thank you so much! 😄👍
Right!
So I actually decided to stop procrastinating, and you don't know how much you made me remember what I loved from python. Thank you so much, Tim
I just watched and coded simultaneously with Tim... The only thing I couldnt manage to learn "What" Bracketss!? Keep up bro Im coding with you for 2 years now.
this video taught me more about implementing databases within a website than an entire masters degree that i already earned. thank you so much!!!
Great tutorial. In the Python community "underscore underscore" is called "dunder". Just a thing to ease your tongue.
Double Underscore -> Dunder
For those how come to the comment session with create_all() to create database error 1:33:45.
As per the new version, this is the fix:
def create_database(app):
if not path.exists('website/'+ DB_NAME):
with app.app_context():
db.create_all()
print("Created Database!")
Thanks for the video. @TechWithTim
still it gives me this error message (ImportError: cannot import name '_app_ctx_stack' from 'flask' ) @siddheshkhadapkar3071
THX
thx
Thanks man! I too got the same error and applied this same piece of code to debug it. But I ran into another error while creating users for the signup page. I did exactly what he did, but the error says ValueError: Invalid hash method 'sha256'.
Any help would be extremely appreciated
I have watch countless web tutorial on so many different topics, and this is the best one so far. Details and pace were perfect.
This tutorial is amazing. I've done it beginning to end 4 times so far and each time I understand a little more about what's going on.
bro i ran the whole thing yesterday and it was working all good but today when i tried to run it has all sorts of errors and my envn has been set to production return self.wsgi_app(environ, start_response) this types of errors occured could you help
Excellent tutorial Tim. I watched many others on Flask and got no clue. After watching yours, just realised Flask is around 90% of what I already knew on front-end coding with PHP
i followed your tutorial, and running this web server on a arm based cpu media box, running openwrt os, everything works perfectly
I finished my other Python project and thought of exactly this. Tim never disappoints.
Hell ya
Can I ask you what your project was.
Just looking for a nice but not too hard project to practice.
Thank you.
@@Eric-dd8bk Was thinking of making a personal website (about my programming projects). Ended up starting it in Golang as I didn't need databases and login stuff, but still great video.
do you know theme is in his vs code?
can you send me the full code(zip) of the project? please
Just to let other viewers know, the jenga scripts are now outdated and the code will not work anymore. Check the documentation for updated scripts that work. Other than that, great video!
This is the best instructional video for programming I have ever seen! Also, if the small errors were deliberate (as I suspect), this makes it all the more effective as it shows troubleshooting as well.. Absolutely fantastic !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Im new to coding so lot of this stuff went over my head, but wow really enjoyed this tutorial! Much respect.
I love that you leave in typos and errors because I usually try to correct them myself to make sure that I'm understanding well.
It's also nice to have all those modules to look into. it saves up the time of searching everywhere for interesting modules and plugins (so you get more time to practice them !)
Also, the additional stuff like the version import methods are super interesting.
Now I want to redo it myself and create my portfolio website for my programming projects. Thanks man I'm learning programming on the side with a full time job, your videos make it fun and practical.
Have you been able to get a new job yet? I'm in the same boat
I'm trying to build a flask crud website currently and I'm strugling heavily with the one to many relationship in my database. I reaalllyy hope this video will cover it but judging from the 5 minutes I've seen so far I can tell even if my specific issue isn't covered there's going to be a lot for me to learn from watching you.
I really like that you keep your mistakes in the video, even the 'simple' things like relative importing. It definitely humanises you and makes you more relatable. It's a nice reminder that coding is hard and we're not doing simple things here.
can u help me?
Min 28:13 he said to copy the thing
I didn't know from where bc my English isn't good can u help me?
What he meant was that you should copy it from his code base from Github.
The link to get to his Github is below this video.
Great video! Consice yet precise. One note here for those who want to take this project to the next level:
You may use WTForms for flask to create forms more elegantly. It will also help you to modulerize you app.
I would say that's one of the best coding tutorials I've ever watched. Thank you very much!
Really helpful Tim! The only part I would like you to update about is that the 'db.create_all(app=app)' method is obsolete in the latest version of flask-sqlalchemy. Instead we now need to us a 'with app.app_context():' to use 'db.create_all()'. Also in my PC, the new database is created in a new folder called 'instance' by default using the same code as yours. It would be great if you could explain why that happens.
THANK YOU SOO MUCH THIS IS EXACTLY WHAT I NEEDED :)
@@asethipro4952 You are welcome!
I used with app.app_context():
db.create_all(), but i'm still getting some errors, when I removed it I didn't get any errors
@@sheriffOladimeji-xn2so that's what happened to me aswell lmao
Hi, this might be a bit late, but if you want your db file to be placed on the website folder, you need to specify the full path in the SQL_ALCHEMY_URL configuration.
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{path.join(app.root_path, DB_NAME)}'
Just a small note, SQLalchemy no longer accepts 'app' in create_db(), but the code has been simplified and no longer requires a function to complete the same task. Cheers!
I was in these muddy waters for the past half an hour while watching corey's old videos, man. Figured out it must be because the libraries got updated but couldn't manage to find a way since. Would love it if you elaborate!
@@metalskull8687 I've been confused about the same thing, and I can't give you a good explanation of how to solve this but if you uninstall flask-sql alchemy and reinstall it as the older version, flask-sqlalchemy==2.5.1 it should work. Hope this helps.
@@charlieguthmann2531 It seems there's no other way around other than this. Thank you very much, it helped!
bro i am not able to use
create_all() function..
@@hudsong2844 you can comment out the entire create_app lines and instead use
with app.app_context():
db.create_all()
1:33:40 in the video when he's having the import problem, I think what he meant to say or do was:
from . import models
because that's what I did, for everyone else using this blueprint to add more classes other than user and notes. Also if you're having the missing module SQL alchemy and/or flask login just go to your terminal and install both modules. I ran into those errors even though I installed flask it didn't come with everything so to make it clear in your terminal type:
pip install -U Flask-Login
and/or
pip install Flask-SQL-Alchemy
Then everything should work fine. Also to add on at the 1:54:39 section when you are in the __init__.py and you're doing the whole login_manager.user_loader part. If you used the from. import models to optimize your code, you'll get an error cause User isn't defined with the code written in the video. You have to tell the computer User is from the models module like this.
@login_manager.user_loader
def load_user(id):
return models.User.query.get(int(id))
not
@login_manager.user_loader
def load_user(id):
return User.query.get(int(id))
like in the video. Just so you know. Hope this helps someone.
thanks
db = SQLAlchemy()
def create_app():
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///project.db"
db.init_app(app)
from . import models
with app.app_context():
db.create_all()
return app
# There is no need for that create_database function. SQLAlchemy will already not overwrite an existing file, and the only time the database wouldn't be created is if it raised an error.
@@philosophe2517 with that , return User.query.get(int(id)) won't work , the user won't be defined
This really helped me in both the timestamps you mentioned ! Thanks a lot !
f
just want to mention, is very important to structure the project in the exact same way he has his folder (i got trouble because of that). Dude your explanation and tutorial is just amazing, thnx great way to introduce us in web dev with python and flask
Right! I did too
The way you explained everything was INCREDIBLE . Thank you so much for making such a great web tutorial.
This is the video I've been trying to find!!! SO EXCITED TO GET OFF WORK AND DO THIS ENTIRE VIDEO
For the first time in a while, I found a video tutorial thats genuinely interesting :D
Amazing tutorial! I had some experience with sql server and power bi, and web dev but not together. Super easy to follow!
this is my first time with python, and I'm amazed at how more straightforward it is than c++
i can't thank u enough for this,i was struggling for building the backend for my webpage for the mini project in college.Because of u i was able to complete the login page and signup,now i just have to link the url for previously build front end ,tysm
Thank you for making this! It was very simple to follow, and I love that I went from knowing nothing about flask to having a functioning website (also thank you for posting the code in the description, that was also very helpful). This was exactly what I was looking for!
I was learning flask and i saw this notification
It was like a gift from the above
It's called Machine Learning.
Google knows what we want.
Awesome stuff Tim!
covers everything I typically need in Flask within a nice project.
Also for the sake of simplicity, I like to flash the messages with categories equal to danger/success to match the bootstrap alert classes and the in the Jinja template, I show both types of messages in one loop like this
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
{{ message }}
×
{% endfor %}
{% endif %}
{% endwith %}
+1 for all the praise. It seems like every single guide I found on how to get started with Flask and any kind of web site integration for Python was all "buy this app" or "use our service" or totally glossed over critical starting point info so you had to already know how to set everything up and they just showed you some code afterward with no explanation of what parts of their starting point mattered and what didn't. As someone learning this on my own rather than through formal sources this was extremely helpful.
I'll definitely be coming back to watch a lot more of your content as time permits.
Thank you very much Tim, your teaching has been superb. I have never seen such a clear and complete exposition. Thanks forever Tim.
Superb quality tutorial. This answered a lot of long-standing questions I had.
Video idea : When to learn your next programming language?
If you are using the latest version of python and flask as of 9/1/24 you could encounter an error with sha256 not being recognized in the sign up function. replace sha256 with 'pbkdf2:sha256' and it should work
thanks its working
Works perfectly!
God bless you!
It took me a minute but I figured it out. Bootstrap 5 is slightly different. Without having to go into detail here I suggest that if anyone is using BS5 please read the documentation.
I have done frontend many times with HTML CSS and JavaScript, but it's my first time in backend programming
the video was a good video and I really appreciate your handwork
it was great feeling after finishing this project
23:00 I think If you are using VScode you can just write "!" at the beginning of the HTML file and a drop-down menu pops up and you can choose one of the items so VScode can auto-complete the framework for the HTML source code.
I might be wrong though as I haven't really used VScode for a bit.
Yep this works in VSCode can confirm.
Btw if you're having problems with the "generate_password_hash()" function, idk since when but they changed the sha256 method to "scrypt". It's the same just with a different name. :)
thanks bro, that really helped me a lot
or 'pbkdf2:sha256'
I created my first app with your instructions.. Very clear precise and perfect. I followed along very well. Thanks man.. Even at 2yr old its still relevant i think..
Whatching in 2024! You helpsd me a lot in my final year project. GREAT VIDEO!
I have enormous gratitude towards you Tim, thank you for your effort !
This is pure gold... 🤗🤗🤗🤗 Thank you very much Tim for this tutorial. It's a life saver 😅😅
2024 Update:
1. If pip install flask does not work simply do - "pip3 install flask"
You're welcome!
This man did the website in 2 hours. This took me 2 days LOL. Ty for the tutorial!!
Brilliant. I was about to be a chump and purchase a course online. However, this is better than most and for the amazing cost of free on TH-cam. Thanks a million times over and never change. You rule!
Regarding the problem at the end: Every time you make changes to the javascripts you have to clear your cashe and reload it afterwards.
Strg + F5 or Ctrl + F5
🔥Hey Tim, needed this one. I just wanted to use databases for my website but none were clear. Nailed it bro🔥🔥🔥. Thanks
Tim I'm making a chat feature in my website. How do you add chat history based on the chat rooms? Could you please make a tutorial on that? Not many people make very reliable tutorials on chat apps and chat history for specific rooms. I have searched all over the web.
do you know theme is in his vs code?
@@pratiksanganii the name is: Identical Sublime Text Monokai theme
Doesn't sound hard, but your request is too specific, when you are trying to search how to resolve a problem like this, you need to divide the problem into sub-problems more:
How are your chat rooms structured?
With the structure you have right now, can you make this happen or do you need to modify it?
So, for example, what is a chat history? it's basically a server-stored piece of text, nothing else.
So if you are sending the messages from client to client, you'll need to first make that message go through a function that appends each message to the end of a string or file, now, how you structure the way to save the messages is up to you too: plain text or some sort of data structure so you have access to the user's id, msg, hour that it was sent, etc
Start implementing the feature by resolving the now smaller problems (passing each message through a function, having where to save it, formatting it to your liking before saving, reading the chat history, etc) and when you get stuck, it will probably be something more general:
Not "How to read a chat history from a database"
But "How to get a field's content from a database"
Or Not "How to make a function that saves chat messages into a file"
But "How to append data to the end of a file"
Here’s the easy, lazy way
1. Look up how to make chat rooms using flask
2. Click the first result
3. Select the code
4. Ctrl+C then Ctrl+V on ur code editor.
5. Recompile and voila!
@@jgabt 😂😂😂
I like how deliver and explained flask concept step by step, hats off coz I never come across such tutor on Yotube
When I started with python I was struggling and when I saw you I got better and better. Thank You
Amazing tutorial!. This is the best instructional video for programming I have ever seen!
assalamualakum
this tutorial is exactly what I have been looking for. Thank you so much!
One video of how to build apis in Flask really helped me complete a Gig, where i had an intercom software with is back end as a flask api, thanks alot, you were my teacher as a beginner right now am what you can call a pro thanks bro.., all the best
I was getting into backend web dev in Python, and then you uploaded this :D
If Tim uploaded it 2 months before then if would be great for me
samee
Hello Tim
I enjoyed your video
Pls can you make a video on how to create the same login and sign-up system with Django
For those who has a problem with the delete button
I found the solution, replace in the base.html:
type="text/javascript"
src="{{ url_for('static', filename='index.js') }}"
by this
(Thanks ChatGPT)
@Peter Okos rip for the lost 25 minutes.
You are great, Tim. Two years later, this is as new as ever. It's the best flask framework tutorial I have seen. Thank you a million times. 🍻 cheers
Another error found is, when running your code in your browser, it might say 'templates not found: home.html'
This is because, there's no folder imported to the '__init__.py' for lookup
You might write in the '__init__.py' :
from (name of your template parent folder. Mine was 'WEBSITE') So I got:
from WEBSITE import templates
Good to go🥰
Okay now this is very exciting for me.....
@Vincent Ludwig I am learning that as well..
Your tutorials are the best, Tim! Thanks a lot for sharing your knowledge! It's really helpful!
Do you have tutorial using MySQL database as well?
started a project and wanted to do it with python. Found this video and he is making almost the exact website that i am
The tutorial is sooo good, i am not good in english, but i understood everything, thank you
Super helpful, pal. BTW: "werkzeug" = German for "tool". Pronounce it like "verktsoik"
Das ist perfekt, danke!
A little correction in the __init__.py's last function:
def create_database(app):
with app.app_context():
if not path.exists('instance/' + DB_NAME):
db.create_all()
print('Created Database!')
Thank you. I currently stuck at this point! 😀
thanks brother
@user-xb3rl5bv7c that is correct, but additionally change the path from 'website/' to 'instance/'. db seems to be automatically created at a different location
@@atree4645 yeah i thought that instance thing was only with me but guess that's how it's happening now. i have edited the comment now
Tim, I love you for not using TH-cam adds.
This covers just about every piece of information I needed to get an amazing head start for a similar project at work. Thank you!!
Tim, would you cover CI/CD pipeline for easy deployment. Thanks ☺️
Tim pls
I'm very grateful for the effort you've put in here. It has really helped me understand python and flask better. I appreciate it.
You're very welcome!
@@TechWithTim at 37:37
why is my text color blue?
@@Bern9917 same problem, have you fixed that?
probably missing or a typo in the nav attributes/arguments, if you have navbar-dark then the text shouldnt be blue @@Bern9917 like in this tutorial
Is there anyway to do the Delete button feature with Python instead of adding JavaScript?
Excellent job, went thru the whole thing, no flaws... only had to paste the warnings from bootstrap 5 doc, but everything else worked. Thank you
Came to learn Flask, met with bootstrap, love it man you are great.
bro you also explained the login and navbar manipulations and such. so good.
Hi ! I m following all your instructions from the start but it seems like i can t import either views or auth . An error mssg pop out (can t import name 'views" from 'website.views' whenever i try to import them in __init__.py file , thanks in advance and love your videos : )
having the same problem right now
Hi, did you fix this error? I am getting the same?
also, I did not solved yet
Me: sees your old Flask tutorials
Also me: hmm, looks interesting, I'll give it a try
A few hours later: this video appears
Me: BRO WTF
do you know theme is in his vs code?
@@pratiksanganii It's called monokai
Wow! Amazing video! Thank you so much! One quick typo at 1:07:43, it should say "alert-dismissable". Also, is there a much simpler way to add the delete note option? I got a bit lost with all the custom JS just for that simple function. Thank you again!
g;pcl
the only good programming tutorial ever, you are the first person to make a tutorial that doesn't treat the viewer like they are stupid. I wouldn't be watching this if I didn't already have at the very least a basic understanding of programming. Too many tutorials over explain the basics, when they should be telling you to go learn them first.
This is THE best Flask Tutorial on TH-cam. Thanks Tim!
Right when CS50 finance was giving me headaches... Thank you!
Try cs 30
Thanks for this Tim! Can I request a simple tutorial on flask+react? :)
this is the best tutorial about python web developing so far i've ever seen, thank you !
First time I sit and watch such a long video and still I hoped it would last more...
Congrats Tim! And thx