Welcome to the Flask Starter Template! This template provides a solid starting point for building a Flask web application with authentication, database integration, templating, and minimal styling using Matcha CSS.
This template includes basic features that every Flask developer needs when starting a new project. It offers:
- Authentication system (signup, login, logout)
- Database integration with SQLAlchemy
- Templating with Jinja2
- Minimal styling using Matcha CSS
- Protected routes accessible only after login
You can quickly build upon this structure and add more features as needed!
- Flask: A lightweight WSGI web application framework in Python.
- SQLAlchemy: SQL toolkit and Object-Relational Mapping (ORM) for Python.
- Flask-Migrate: Extension that handles SQLAlchemy database migrations via Alembic.
- Matcha CSS: A Drop-in semantic styling library in pure CSS. Learn more about Matcha CSS here.
For a detailed breakdown of this template, check out this video by NeuralNine.
Route | Description |
---|---|
/ |
Landing page |
/signup |
Sign up for a new account |
/login |
Log into an existing account |
/logout |
Log out of the current session |
/protected |
A protected page accessible after login |
To run this template locally, follow these steps:
-
Clone the Repository
git clone <repository_url> cd flask_template
-
Create and Activate a Virtual Environment
python -m venv .venv source .venv/bin/activate # On Windows, use .venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Set Up the Database Initialize, migrate, and upgrade the database.
flask db init flask db migrate flask db upgrade
-
Run the Application
python run.py
Any time you make changes to the models, ensure you follow these steps to migrate and apply changes to the database:
flask db migrate
flask db upgrade
If you find this template useful, give it a ⭐ on GitHub!