There are many frameworks that allow building your webpage using Python, like Django, flask, etc. Flask is a web application framework written in Python. Flask is based on WSGI(Web Server Gateway Interface) toolkit and Jinja2 template engine. Its modules and libraries that help the developer to write applications without writing the low-level codes such as protocols, thread management, etc.
In this article, we will learn how to make a todo list app using the Flask framework. In this app, you can add your todo items and mark them as complete or incomplete.
pip install Flask
Basic setup :
Step 1: First make basic folders
mkdir app && cd app && mkdir static && mkdir templates
Step 2: Make some basic python files to write the code and name it as you desire.
Step 3: Run the below command to start the server
touch run.py the app
Step 4: Change directory to app–
Step 5: create models.py for database, routes.py for urls/views and __init__ file to package our app
touch models.py routes.py __init__.py
Step 6: Goto templates/ directory and create index.html file
cd templates && touch index.html
Step 7: Goto static/ directory and create main.css
cd static && touch main.css
Now, open the project folder using a text editor. The directory structure should look like this :
Run the todo app using the below command
- How to write an empty function in Python - pass statement?
- Operator Functions in Python | Set 2
- Time Functions in Python | Set-2 (Date Manipulations)
- Send mail from your Gmail account using Python
- Python – The new generation Language
- Print Single and Multiple variable in Python
- Increment and Decrement Operators in Python
- str() vs repr() in Python
- Swap two variables in one line in C/C++, Python, PHP and Java
- Generate all permutation of a set in Python
- Class or Static Variables in Python
- trunc() in Python
- Division Operators in Python
- Interesting facts about strings in Python | Set 1
- When to use yield instead of return in Python?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : itsvinayak