This is a production-ready Flask application boilerplate designed for large-scale applications with MySQL integration.
.
├── app/
│ ├── __init__.py # Application factory
│ ├── api/ # API blueprint
│ ├── auth/ # Authentication blueprint
│ ├── models/ # Database models
│ └── errors.py # Error handlers
├── migrations/ # Database migrations
├── logs/ # Application logs
├── .env # Environment variables
├── .env.example # Environment variables template
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── app.py # Application entry point
└── README.md # Project documentation
- Factory pattern for application creation
- Blueprint-based structure for modularity
- SQLAlchemy integration with MySQL
- JWT authentication
- CORS support
- Error handling
- Logging configuration
- Environment-based configuration
- Database migrations support
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy
.env.example
to.env
and configure your environment variables:cp .env.example .env
-
Initialize the database:
flask db init flask db migrate flask db upgrade
-
Run the application:
flask run
- Add new models in
app/models/
- Create new API endpoints in
app/api/
- Add authentication routes in
app/auth/
- Configure database in
.env
-
Set environment variables:
export FLASK_ENV=production
-
Use a production WSGI server:
gunicorn app:app
- Create a new branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License.