TODO-app/README.md
2025-12-16 20:46:16 +01:00

108 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# TODO Flask + SQLite
Ett enkelt TODO-system byggt med **Python**, **Flask** och **SQLite**.
Projektet är uppsatt med **app factory-pattern**, **pytest-tester** och är redo att köras i **GitHub Actions CI**.
---
## ✨ Funktioner
- Skapa TODO-poster (title, description, status)
- Uppdatera status (`not-started`, `in-progress`, `done`)
- Ta bort TODO-poster
- SQLite som databas
- Tester med pytest
- CI-redo (GitHub Actions)
---
## 🗂 Projektstruktur
```text
.
├── app.py # Flask app (app factory)
├── db.py # Databasfunktioner (SQLite)
├── todo.db # SQLite-databas (lokalt)
├── requirements.txt # Runtime dependencies
├── requirements-dev.txt # Dev/test dependencies
├── templates/
│ ├── base.html
│ └── index.html
├── static/
│ └── style.css
├── tests/
│ └── test_app.py
├── Dockerfile
├── pytest.ini
├── requirements.txt
├── requirements-dev.txt
├── .gitignore
├── .dockerignore
└── README.md
```
## 🚀 Kom igång lokalt
### 1. Klona repot
```bash
git clone <repo-url>
cd todo
```
### 2. Skapa och aktivera virtuell miljö
```bash
python3 -m venv venv
source venv/bin/activate
```
### 3. Installera beroenden
```bash
pip install -r requirements.txt
pip install -r requirements-dev.txt
```
### 4. Starta applikationen
```bash
python app.py
```
### Öppna i webbläsaren:
```
http://127.0.0.1:5001
```
---
## 🧪 Tester
Kör alla tester lokalt med pytest:
```bash
pytest
```
Med kodtäckning(coverage)
```bash
pytest --cov=app --cov-report=term-missing --cov-fail-under=80
```
## 🤖 CI GitHub Actions
Projektet kör automatiskt tester vid varje push och pull request via GitHub Actions.
Exempel på teststeg i CI:
```bash
pytest --cov=app --cov-report=term-missing --cov-fail-under=80
```
## 🐳 Docker (valfritt)
Detta projekt kan enkelt dockeriseras för lokal utveckling eller deployment.
Exempel (snabbstart):
```bash
docker build -t todo-app .
docker run -p 5001:5001 todo-app
```