Python Flask Beginner Tutorial - Todo App - Crash Course

  Рет қаралды 85,182

Patrick Loeber

Patrick Loeber

Күн бұрын

Learn how to write your first TODO App with Flask in this Crash Course. Flask is one of the most popular web frameworks written in Python. Flask is a lightweight framework that is perfect for beginners. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. Learn how to:
- Install and Setup Flask
- Define routes
- Use templates
- Use a Database (we use SQLAlchemy and SQLite Database)
- Build TODO App functionality
- Add styling with Semantic UI
~~~~~~~~~~~~~~ GREAT PLUGINS FOR YOUR CODE EDITOR ~~~~~~~~~~~~~~
✅ Write cleaner code with Sourcery: sourcery.ai/?... *
📚 Get my FREE NumPy Handbook:
www.python-engineer.com/numpy...
📓 Notebooks available on Patreon:
/ patrickloeber
⭐ Join Our Discord : / discord
If you enjoyed this video, please subscribe to the channel!
You can find the code here:
github.com/patrickloeber/flas...
Flask: flask.palletsprojects.com/en/...
Semantic UI: semantic-ui.com/
You can find me here:
Website: www.python-engineer.com
Twitter: / patloeber
GitHub: github.com/patrickloeber
Icons:
fontawesome.com/icons/check
fontawesome.com/icons/bars
#Python #Flask
----------------------------------------------------------------------------------------------------------
* This is a sponsored link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏

Пікірлер: 115
@sphinxz_gaming
@sphinxz_gaming 2 жыл бұрын
I love the Semantixc UI! It is very easy to style the page! And I liked your video as well and subscribed! Amazing content! Keep it up the good videos! It helps on my programming ❤️🙏
@popcycleism
@popcycleism 2 жыл бұрын
This was very satisfying. The topping was your introduction to Semantic UI giving more possibilities from using bootstrap. Now to learn how to upload photos! Thank you for this tutorial.
@syedmuhammadraza9534
@syedmuhammadraza9534 3 жыл бұрын
Just completed this TODO-APP really helpful appreciated!
@adaum79
@adaum79 2 жыл бұрын
Perfect! Simple and clear, like always.
@goodgrow_io
@goodgrow_io 3 жыл бұрын
This video is amazing. Best guide I've seen so far.
@patloeber
@patloeber 3 жыл бұрын
Glad you like it :)
@joeygaller8761
@joeygaller8761 Жыл бұрын
GOOD DAY SIR I MAY BE HAVING A PROBLEM ON THE DB_SQLITE TABLE I WONT AUTOMATICALLY CREATE ANOTHER FOLDER I FOLLOW ALL YOUR INSTRUCTIONS BUT IT WONT JUST CREATE ANOTHER FOLDER AND JUST HAVE AN ERROR
@crazyGodLikE
@crazyGodLikE 3 жыл бұрын
I like your pace and you explain concepts well. Thank you.
@patloeber
@patloeber 3 жыл бұрын
Glad it was helpful!
@KeyserTheRedBeard
@KeyserTheRedBeard 2 жыл бұрын
impressive upload Python Engineer. I killed that thumbs up on your video. Continue to keep up the exceptional work.
@newsjuice7404
@newsjuice7404 2 жыл бұрын
It was awesome thanks a lot just a little input in for loop if you replace{{ todo.id }}with {{loop.index}} it ll automatically update the indices if you delete any in the middle or top
@LearnBr0
@LearnBr0 6 ай бұрын
Thanks Patrick! I'm starting with Python and found your tutorial quite useful. Keep up the good content 👏
@I_am_pradeep
@I_am_pradeep 3 жыл бұрын
Great tutorial. Very Helpful. Thank You So Much!
@patloeber
@patloeber 3 жыл бұрын
Thanks!
@itsblueworld3591
@itsblueworld3591 Жыл бұрын
A very well explained tutorial, totally understandable..
@aidangasim
@aidangasim 3 жыл бұрын
its amazing,useful concise and clear,i am eternally thankful ))
@patloeber
@patloeber 3 жыл бұрын
Thank you! Glad you like it :)
@liker2356
@liker2356 2 жыл бұрын
Amazing video helped a lot!!
@crystal-arts-1
@crystal-arts-1 Жыл бұрын
Thank you for the awesome tutorial!
@malcolmrichardson
@malcolmrichardson 2 жыл бұрын
Thank you! Great tutorial!
@junivensaavedra882
@junivensaavedra882 Жыл бұрын
Excellent content. Thank you very much. :D
@shreyashimukhopadhyay6354
@shreyashimukhopadhyay6354 3 жыл бұрын
Amazing tutorial! Thanks a lot!
@patloeber
@patloeber 3 жыл бұрын
Thanks!
@aryakrishna4932
@aryakrishna4932 3 жыл бұрын
awesome tutorial ! thanks for this!
@patloeber
@patloeber 3 жыл бұрын
thanks for watching!
@hakusho04
@hakusho04 3 жыл бұрын
exactly what i need to start my flask journey thanks
@patloeber
@patloeber 3 жыл бұрын
nice!
@cngetich37
@cngetich37 2 жыл бұрын
Great Tutorial
@yusufsAnt31
@yusufsAnt31 2 жыл бұрын
Great tutorial
@ombrebyaarti3024
@ombrebyaarti3024 2 жыл бұрын
Thanks for sharing…it help to improve.
@alexandergdansk
@alexandergdansk 2 жыл бұрын
Super! Thanx for it!
@papasmoke3311
@papasmoke3311 2 жыл бұрын
One thing i don’t understand is: why does he create a new database every time the program gets run. wouldn’t it be better to check if a db exists?
@mateen161
@mateen161 4 жыл бұрын
Very helpful content. Thank you!
@patloeber
@patloeber 4 жыл бұрын
Glad you like it :)
@gowthambhat1498
@gowthambhat1498 2 жыл бұрын
great tutorial
@ammarsajjid8258
@ammarsajjid8258 2 жыл бұрын
Thank You for the video.
@muhammadzubairbaloch3224
@muhammadzubairbaloch3224 4 жыл бұрын
dil khush kar detay ho bhai. really nice work.
@patloeber
@patloeber 4 жыл бұрын
Thanks!
@creyssu
@creyssu 3 жыл бұрын
Bro you help me a lot with the flaskAlchemy, thank you !
@patloeber
@patloeber 3 жыл бұрын
Happy to help
@mohammedchoupaqee5530
@mohammedchoupaqee5530 Жыл бұрын
It is an excellent course tutorial with professional Engine Good Luck ,
@dhineshbabu9376
@dhineshbabu9376 3 жыл бұрын
Awesome Tutorials.. Simple and Neat .. :)
@patloeber
@patloeber 3 жыл бұрын
Thanks!
@PythonDevelopment
@PythonDevelopment 2 жыл бұрын
This greate content! Awesome
@rishabkumar9578
@rishabkumar9578 3 жыл бұрын
You are a Gem in a bag of rocks Mr.Python !!!
@patloeber
@patloeber 3 жыл бұрын
Thanks a lot!
@THOMASKUTTYREJI
@THOMASKUTTYREJI 3 жыл бұрын
thank you so much .... an amazing video...
@patloeber
@patloeber 3 жыл бұрын
glad you like it!
@emmachuksudeji9477
@emmachuksudeji9477 2 жыл бұрын
thanks again
@bryanchambers1964
@bryanchambers1964 Жыл бұрын
I'm very confused right from the start (1:45). Where are you entering: git mkdir flask-todo I think its just in your terminal right? I did this in my terminal and it says 'mkdir is not a command'. I installed 'git' too so I don't understand this. If take out 'git' and just enter 'mkdir flask-todo' it works but my "Hello World" website doesn't work in the following steps.
@himanshushukla787
@himanshushukla787 3 жыл бұрын
Hey man nice tutorial. I made the app by following the tutorial but in my app the title of the todo always says title instead of the title that I put in to the text box and I can't figure out what is wrong.
@gillarajieprasatya812
@gillarajieprasatya812 2 жыл бұрын
i dont know why, but i now im falling in love with flask
@playgoods
@playgoods 4 жыл бұрын
amazing
@patloeber
@patloeber 4 жыл бұрын
thanks!
@ssk-ct7cr
@ssk-ct7cr Жыл бұрын
Very good tutorial! I wish to add the functionality of deleting all the items at once by the click of a button ('Clear todos', for example). Does someone know how I could do this?
@rachit6099
@rachit6099 4 жыл бұрын
Thankyou for this video just wanted to know which theme are you using for visual studio code
@patloeber
@patloeber 4 жыл бұрын
Have a look at my newest video :) There I show my VS Code setup. It's the night owl theme
@kshitijgupta6175
@kshitijgupta6175 3 жыл бұрын
In my system, VSCode doesn't show it just shows [] this. Any suggestions how to tackle this problem?
@wamiqmushtaq2825
@wamiqmushtaq2825 5 ай бұрын
Patrick would love u to do a separate tutorial on using flask sql alchemy, it is much needed!!
@mctosima
@mctosima Жыл бұрын
As of Flask-SQLAlchemy 3.0, all access to db.engine (and db.session) requires an active Flask application context. db.create_all uses db.engine, so it requires an app context.
@ashiwal9910
@ashiwal9910 Жыл бұрын
I am stuck there can u pls guide me?
@gokulkrishnan4721
@gokulkrishnan4721 Жыл бұрын
@@ashiwal9910 Just above db=SQLAlchmey (app) add this line: with app.app_context(): -> By doing this you will get instance folder 📁 in that you can see .db file -> If you don't want to do this just use SQLAlchmey version 2.5.1 (pip install flask-SQLAlchemy==2.5.1) you can easily push data from the python shell (ex: >>> from app import db >>> db.create_all() ) I hope this helps you :(
@princeakpolo1074
@princeakpolo1074 Жыл бұрын
just above -> app = Flask(__name__) add this line below it: app.app_context().push()
@harryayce11
@harryayce11 2 жыл бұрын
What about implementing "create","delete" etc in an async manner?
@abdullah-sx2qf
@abdullah-sx2qf 2 жыл бұрын
Hey, how would I make it so each user that logins in has their own task app?
@I_am_pradeep
@I_am_pradeep 3 жыл бұрын
can you please tell me how to validate form in this ?
@eccomi21
@eccomi21 3 жыл бұрын
Thanks for the tutorial! However im running into a slight issue. Im using pycharm as my IDE. i was not able to install FlaskSQLAlchemy the normal way. it would throw an error. So i had to resort to using the command "python -m easy_install SQLAlchemy" So i managed to install it with that command, but now despite it being in the right venv, showing in the list and all when trying to import it it throws the following error: "No module named 'flask_sqlalchemy'" Even after googling, all the answers i found that matched my IDE and OS (being win10) i still cant figure out what the problem is. Do you have any idea what the problem could be?
@eccomi21
@eccomi21 3 жыл бұрын
solved my own question. make sure to follow his tutorial letter by letter. theres two different flask sql alchemy packages.
@efeakaroz6686
@efeakaroz6686 3 жыл бұрын
I love your vid. Also what is your vscode theme
@patloeber
@patloeber 3 жыл бұрын
Thanks! It's the night owl theme...
@anithapoly6849
@anithapoly6849 2 жыл бұрын
How can this be done in sqlite3 database in pycharm
@bryanchambers1964
@bryanchambers1964 Жыл бұрын
Could you mind please explain why you Visual Studio instead of say Jupyter. I tried following this in a Jupyter notebook but the program crashed and couldn't create a web page. It would have been helpful if you gave a little explanation about why you are using Visual Studio and whether it must be done exactly like that. I did everything the same way in visual studio and got the same error again.
@akashpardeshi5721
@akashpardeshi5721 2 жыл бұрын
I'm stuck on one error Windows is not support crypt any Idea how to solve it? I'm using VS Code and Windows 10
@SA-oj3bo
@SA-oj3bo 3 жыл бұрын
Thanks, but how to deploy to a cloud server?
@Stone8age
@Stone8age 4 жыл бұрын
Nice job dude, any plans for a django one?
@patloeber
@patloeber 4 жыл бұрын
Django crash course is on my list too :)
@ashishbhardwaj8609
@ashishbhardwaj8609 Жыл бұрын
Hello Sir. Great tutorial, especially for a beginner. I created the app following the tutorial, but, when I tried deploying it using Vercel, it showed "500 Internal Server Error". However, it works perfectly fine when I tested it using the terminal on my local server... Please provide guidance
@kushlawatidevi1101
@kushlawatidevi1101 9 ай бұрын
try using wsgi as output gateway
@OmaimaHasan
@OmaimaHasan 8 ай бұрын
Hey, i was following along up until adding a database. SQLAlchemy was installed but now its not working when i run the app.py file
@OmaimaHasan
@OmaimaHasan 8 ай бұрын
its saying that RuntimeError: Working outside of application context.
@sendyourbae
@sendyourbae 3 жыл бұрын
hi. i have some problems with this tutorial. i want to add another field called name, so this todo apps have todo field and name field for someone who writes it. how can i insert the name into the app.py and display it? i will wait for your reply. thank you
@patloeber
@patloeber 3 жыл бұрын
the same way I integrated the "title"
@sakshisaxena8913
@sakshisaxena8913 3 жыл бұрын
any tutorial on flask with Postgres sir?
@novaria
@novaria 3 жыл бұрын
SQLalchemy allows you to simply connect to a postgreSQL database AFAIK.
@shreyashimukhopadhyay6354
@shreyashimukhopadhyay6354 3 жыл бұрын
Could you please also show how to build Machine learning Apps using flask..
@patloeber
@patloeber 3 жыл бұрын
Yes, I do have one more with pytorch and flask right now...
@shri1345
@shri1345 3 жыл бұрын
Hey,I have a quite of an issue on kali linux saying that, directory not found when I try to use /venv/bin/activate
@patloeber
@patloeber 3 жыл бұрын
maybe on linux the command is slightly different than on Mac
@shri1345
@shri1345 3 жыл бұрын
No actually I found out that the files were hidden .But now it works ;)
@prajwalm.s7976
@prajwalm.s7976 9 ай бұрын
At 14:32 I am getting this error - File "F:\flask-todo\venv\lib\site-packages\werkzeug\local.py", line 508, in _get_current_object raise RuntimeError(unbound_message) from None RuntimeError: Working outside of application context. This typically means that you attempted to use functionality that needed the current application. To solve this, set up an application context with app.app_context(). See the documentation for more information.
@shobbyduncan1607
@shobbyduncan1607 2 ай бұрын
did yyou manage?....i still have the same error
@TheFuentes5551
@TheFuentes5551 3 жыл бұрын
I do have to ask a question. What is better to learn Flask or Django? Expecialy for begginer
@patloeber
@patloeber 3 жыл бұрын
It depends on what you want to do. Both are great frameworks. Flask is more lightweight and easier for beginners. However, if you want an app with user management/authentication, then I would go with Django since it takes care of a lot of things for you.
@TheFuentes5551
@TheFuentes5551 3 жыл бұрын
@@patloeber the only reason I ask is because I saw online many advice Django because its easy and very powerful. And as you said Django does does a lot of things for you. So now as a noob i dont know on which to focus on? Or maybe I should learn both? I did saw all your videos and they did help me a lot by the way. I have good understandings of "intermediate" Python skills
@railotrailot521
@railotrailot521 4 жыл бұрын
Hi, where are u from ? interesting accent)))thanks a lot for good content!
@patloeber
@patloeber 4 жыл бұрын
Germany ;)
@sife-i9n
@sife-i9n 3 жыл бұрын
@@patloeber gut ;)
@bryanchambers1964
@bryanchambers1964 Жыл бұрын
Why whenever I try to learn stuff like this all I ever get are error messages and I never get the correct result even if I copy everything exact?
@ssk-ct7cr
@ssk-ct7cr Жыл бұрын
Don't know which error you're having... I got an error related to context. With a slight code modification I got the result expected. I'm sending the code, in case you got the same error: Right at the end of the app.py file: if __name__ == '__main__': with app.app_context(): db.create_all() app.run(debug=True) Hope it helps!
@bryanchambers1964
@bryanchambers1964 Жыл бұрын
@@ssk-ct7cr Thanks, I'll try that when I get a chance and let you know if it worked.
@ssk-ct7cr
@ssk-ct7cr Жыл бұрын
@@bryanchambers1964 Great! ;)
@sawaito
@sawaito Жыл бұрын
Lol, flask is a lot easier than django. I don't know why i'm learning django and not flask 🤨
@tamtonaquib
@tamtonaquib Жыл бұрын
Lol tf was that voice
@TheAmazinRaven
@TheAmazinRaven Жыл бұрын
To anyone having issues w the SQLAlchemy thingy or the app not running properly add this below your todo class (under it, not in it): with app.app_context(): db.create_all() A really kind stranger in a Discord helped me solve this & I wanted to pay it forward. :)
@ataberkpektas8784
@ataberkpektas8784 Жыл бұрын
sir i didnt understand you. where will i write this?
@stephontidd7051
@stephontidd7051 9 ай бұрын
Thanks, this solution still works.
@jbruce87
@jbruce87 Жыл бұрын
Not getting "db.sqlite" to create. I will post my code below. working on a Mac like the video. even tried adding the "with app.app_context():" that other commenters have suggested. no luck
@jbruce87
@jbruce87 Жыл бұрын
from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) @app.route('/') def index(): # show all todos return render_template('base.html') if __name__== "__main__": with app.app_context(): db.create_all() app.run(debug=True)
@jbruce87
@jbruce87 Жыл бұрын
Now im getting this error: Traceback (most recent call last): File "/Users/jb/Desktop/PyFlaskAppThing/app.py", line 9, in class Todo(db.model): File "/Users/jb/Desktop/PyFlaskAppThing/venv/lib/python3.9/site-packages/flask_sqlalchemy/extension.py", line 988, in __getattr__ raise AttributeError(name) AttributeError: model
@iamdavidmohan
@iamdavidmohan Жыл бұрын
@@jbruce87 Had the same problem. Clear the Flask package and the Flask-SQLAlchemy package --> I just cleared everything in the [environment]\Lib Folder which I installed since I started the tutorial Then Install pip install Flask==2.1.0 pip install -Iv Flask-SQLAlchemy==2.5.1 Using this Versions the DB was created
@princysingh1398
@princysingh1398 Жыл бұрын
Get this error while activate env...someone help me out error:- PS C:\Users\THIS\Pictures\flask-todo> \Python27\Scripts\virtualenv.exe venv \Python27\Scripts\virtualenv.exe : The term '\Python27\Scripts\virtualenv.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + \Python27\Scripts\virtualenv.exe venv + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\Python27\Scripts\virtualenv.exe:String) [], CommandNotF oundException + FullyQualifiedErrorId : CommandNotFoundException
@pavelow36
@pavelow36 3 жыл бұрын
amazing
@patloeber
@patloeber 3 жыл бұрын
Thank you!
Amazing weight loss transformation !! 😱😱
00:24
Tibo InShape
Рет қаралды 67 МЛН
Они так быстро убрались!
01:00
Аришнев
Рет қаралды 2,3 МЛН
Supabase Crash Course For Python Developers
39:58
Patrick Loeber
Рет қаралды 37 М.
How to make a Todo App with Python Flask
18:25
Trinity software academy
Рет қаралды 10 М.
Learn Flask for Python - Full Tutorial
46:59
freeCodeCamp.org
Рет қаралды 1,7 МЛН
Simple Todo List App in Flask - Beginner Project
21:19
NeuralNine
Рет қаралды 38 М.
Simple Web App with Flask and Heroku - Python GUI for Beginners
25:07
Python Simplified
Рет қаралды 220 М.
Object Oriented Programming (OOP) In Python - Beginner Crash Course
1:20:54
LangChain Crash Course - Build apps with language models
15:19
Patrick Loeber
Рет қаралды 126 М.
Build & Deploy A Python Web App | Flask, Postgres & Heroku
53:24
Traversy Media
Рет қаралды 269 М.
Python REST API Tutorial - Building a Flask REST API
1:14:01
Tech With Tim
Рет қаралды 758 М.
Amazing weight loss transformation !! 😱😱
00:24
Tibo InShape
Рет қаралды 67 МЛН