This is a simple Todo application built with Flask, demonstrating the use of Flask Blueprints for modular design, SQLAlchemy for database interactions, and Bootstrap for basic styling.
- Add, update, and delete todo items
- Toggle completion status of todo items
- Persist user preferences for theme (dark/light) and sorting order (ascending/descending)
Watch a short demo of the application in action:
demo.mp4
app/__init__.py
: Initializes the Flask app and database, and registers Blueprints.app/models.py
: Contains database models for Todo items and user preferences.app/routes.py
: Contains route definitions for the main app functionality.app/templates/
: Contains HTML templates for rendering the UI.config.py
: Configuration settings for the Flask app.manage.py
: Entry point for running the Flask app.requirements.txt
: Lists the dependencies required to run the app.
-
Clone the repository:
git clone https://github.com/fastfingertips/flask-todo.git cd flask-todo
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Initialize the database:
python manage.py
To start the Flask development server, run:
python manage.py
By default, the app runs on http://127.0.0.1:5000/
.
To run the application on a different port, you can specify the port number when starting the server. For example, to run the app on port 8080, use:
python manage.py run -p 8080
You can also set the port number by modifying the manage.py
file if needed. Open manage.py
and locate the line that starts the Flask application, then add the port
parameter:
if __name__ == "__main__":
app.run(debug=True, port=8080)
Replace 8080
with the port number you wish to use.