59 lines
No EOL
1.4 KiB
Markdown
59 lines
No EOL
1.4 KiB
Markdown
# Flask Login App – Markdown Guide
|
||
|
||
> **Goal** – Build a minimal Flask app that:
|
||
> 1. Uses **SQLite** for persistence.
|
||
> 2. Has a *login* page, an *index* page (requires auth), and a *logout* route.
|
||
> 3. Uses **Flask‑Login** and **Werkzeug** for password hashing.
|
||
> 4. Is ready for a CLI‑AI to read and walk you through the implementation.
|
||
|
||
---
|
||
|
||
## 1. Project Overview
|
||
|
||
- **What it does** – Basic authentication + protected landing page.
|
||
- **Tech stack** – Flask, Flask‑Login, Werkzeug, SQLite, Jinja2.
|
||
- **Why SQLite** – Zero‑config, file‑based DB that ships with Python.
|
||
|
||
---
|
||
|
||
## 2. Prerequisites
|
||
|
||
- Python 3.9+ installed.
|
||
- `pip` available.
|
||
- Optional: `virtualenv` or `venv` for isolation.
|
||
|
||
---
|
||
|
||
## 3. Directory Layout (suggested)
|
||
my_flask_app/
|
||
│
|
||
├── app/
|
||
│ ├── init.py
|
||
│ ├── models.py
|
||
│ ├── routes.py
|
||
│ ├── templates/
|
||
│ │ ├── base.html
|
||
│ │ ├── index.html
|
||
│ │ └── login.html
|
||
│ └── static/ # optional, for CSS/JS
|
||
│
|
||
├── migrations/ # if you later add Flask‑Migrate
|
||
│
|
||
├── config.py # app config (secret key, DB URI, etc.)
|
||
├── run.py # entry point
|
||
├── requirements.txt
|
||
└── README.md
|
||
|
||
|
||
---
|
||
|
||
## 4. Setting Up the Environment
|
||
|
||
1. `python -m venv venv`
|
||
2. `source venv/bin/activate` (Linux/macOS) or `venv\Scripts\activate` (Windows).
|
||
3. Create `requirements.txt` with:
|
||
|
||
```text
|
||
Flask
|
||
Flask-Login
|
||
Werkzeug |