This guide walks through setting up a full-stack To-Do application using:
- Python – Backend programming language
- Flask – REST API
- SQLite – Database
- HTML5 – Frontend structure
- CSS3 – Styling
- JavaScript (ES6) – Frontend functionality
- Git – Version control
- Visual Studio Code – Development environment
| Technology | Purpose |
|---|---|
| Python 3 | Backend programming language |
| Flask | REST API |
| SQLite | Database |
| HTML5 | Frontend structure |
| CSS3 | Styling |
| JavaScript | Client-side functionality |
| Git | Version control |
| VS Code | IDE |
Download Python from:
https://www.python.org/downloads/
During installation:
- ✅ Add Python to PATH
- Click Install Now
Verify the installation:
python --versionDownload Git:
Verify installation:
git --versionConfigure Git:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"Download:
https://code.visualstudio.com/
- Python
- Pylance
- SQLite Viewer
- Live Server (optional)
- GitLens (optional)
- Prettier
- HTML CSS Support
flask-todo-app
Open the folder in VS Code.
git initWindows:
python -m venv .venvmacOS/Linux:
python3 -m venv .venv.venv\Scripts\Activate.ps1.venv\Scripts\activate.batsource .venv/bin/activatepython -m pip install --upgrade pipInstall Flask:
pip install flaskSave dependencies:
pip freeze > requirements.txtSQLite is included with Python and does not require a separate installation.
flask-todo-app/
│
├── app/
│ ├── app.py
│ ├── routes.py
│ ├── database.py
│ ├── models.py
│ ├── schema.sql
│ └── __init__.py
│
├── database/
│ └── todo.db
│
├── static/
│ ├── css/
│ │ └── style.css
│ │
│ └── js/
│ └── app.js
│
├── templates/
│ └── index.html
│
├── .venv/
├── requirements.txt
├── .gitignore
├── README.md
└── run.py
Flask automatically serves:
- HTML from the
templates/folder - CSS, JavaScript and images from the
static/folder
Example:
templates/
index.html
static/
css/
style.css
js/
app.js
Create:
app/app.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)Create:
templates/index.html
This page will contain:
- Application title
- Task input
- Add Task button
- Task list
- Delete/Edit buttons
Create:
static/css/style.css
Use CSS to style:
- Layout
- Buttons
- Forms
- Task cards
- Colours
- Responsive design
Create:
static/js/app.js
JavaScript will:
- Send API requests using
fetch() - Display tasks
- Add tasks
- Delete tasks
- Update tasks
- Refresh the task list
SQLite is built into Python.
Check the version:
pythonimport sqlite3
print(sqlite3.sqlite_version)Create a database:
database/todo.db
The database will be created automatically the first time your application connects to it.
Start Flask:
python app/app.pyor
flask runOpen your browser:
http://127.0.0.1:5000
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /tasks |
Retrieve all tasks |
| GET | /tasks/<id> |
Retrieve a specific task |
| POST | /tasks |
Create a task |
| PUT | /tasks/<id> |
Update a task |
| DELETE | /tasks/<id> |
Delete a task |
The frontend JavaScript will communicate with these endpoints using the Fetch API.
Create a .gitignore file:
.venv/
__pycache__/
*.py[cod]
*.db
.env
.vscode/
.DS_Storegit status
git add .
git commit -m "Initial Flask To-Do App setup"Create an empty GitHub repository.
Then:
git remote add origin https://github.com/<username>/flask-todo-app.git
git branch -M main
git push -u origin mainCheck status:
git statusCommit changes:
git add .
git commit -m "Describe your changes"Push changes:
git pushPull changes:
git pullCreate a branch:
git checkout -b feature/new-featureRun the application:
python app/app.pyInstall dependencies:
pip install -r requirements.txtUpdate requirements:
pip freeze > requirements.txtDeactivate the virtual environment:
deactivateThe frontend should include:
- Task input field
- Add Task button
- Display all tasks
- Mark tasks as completed
- Edit tasks
- Delete tasks
- Responsive layout
- Loading and error messages
The Flask API should provide:
- SQLite database connection
- CRUD operations
- JSON responses
- Input validation
- Error handling
- RESTful API endpoints
By completing this project, you will gain experience with:
- Python programming
- Flask web development
- Building REST APIs
- SQLite databases
- HTML page structure
- CSS styling
- JavaScript DOM manipulation
- Fetch API
- Client-server communication
- Git version control
- GitHub collaboration
- Full-stack web application development