1.4 KiB
1.4 KiB
Flask Login App – Markdown Guide
Goal – Build a minimal Flask app that:
- Uses SQLite for persistence.
- Has a login page, an index page (requires auth), and a logout route.
- Uses Flask‑Login and Werkzeug for password hashing.
- 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.
pipavailable.- Optional:
virtualenvorvenvfor 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
python -m venv venvsource venv/bin/activate(Linux/macOS) orvenv\Scripts\activate(Windows).- Create
requirements.txtwith:
Flask
Flask-Login
Werkzeug