Welcome to the Flask Full-Stack Application Template, an open-source project designed for learning, experimentation, and rapid prototyping. This project provides a modular and scalable structure for building Flask applications that incorporate both front-end and back-end components. It can serve as a starting point for various types of applications or simply as a reference for studying Flask best practices.
⚠️ Disclaimer: This project is provided as-is and is intended for educational purposes. It is not production-ready, and you should use it at your own responsibility. Contributions, feedback, and adaptations are welcome!
- 📦 Modular Structure: Easily extendable using Flask Blueprints.
- 🌐 Front-End Ready: Supports Jinja2 templating with organized static files (CSS, JS, images).
- 🛠️ Database Integration: SQLAlchemy ORM with Flask-Migrate for database migrations.
- 📝 Forms Handling: WTForms integration for form validation and rendering.
- 🧪 Testing Ready: Basic test setup for unit and integration testing.
- ♻️ App Factory Pattern: Flexible application creation suitable for multiple environments.
/my_flask_app
│
├── /app # Application package
│ ├── /static # Static files (CSS, JS, images)
│ ├── /templates # Jinja2 templates (HTML files)
│ ├── /blueprints # Modular blueprints (user, blog, auth, etc.)
│ ├── /extensions.py # Initialize extensions
│ ├── /models.py # App-wide database models
│ ├── /forms.py # App-wide forms
│ ├── /routes.py # App-wide routes
│ ├── /utils.py # Utility functions
│ └── __init__.py # App factory function
│
├── /migrations # Database migrations
├── /tests # Unit & integration tests
├── .env # Environment variables
├── .flaskenv # Flask environment settings
├── requirements.txt # Python dependencies
├── config.py # Configuration settings
├── run.py # Application entry point
└── README.md # Documentation (this file)
git clone https://github.com/omar-2004/Blog-using-flask
cd Blog-using-flask
python -m venv venv
source venv/bin/activate # On Windows: venv\\Scripts\\activate
pip install -r requirements.txt
Create a .env
file in the root:
SECRET_KEY=your_secret_key
DATABASE_URL=sqlite:///app.db
flask db init
flask db migrate -m "Initial migration."
flask db upgrade
flask run
Access the app at: http://localhost:5000
This template can be used for:
- 📚 Learning Flask: Explore Flask’s structure, extensions, and patterns.
- 🧪 Experimentation: Add new blueprints, models, or features to practice your skills.
- 🚀 Starter Template: Use it as a base for your own Flask projects.
💬 Note: The app is not optimized for production usage. For deployment, consider using a WSGI server like Gunicorn and a web server like Nginx.
Basic tests are provided in the /tests
directory.
python -m unittest discover tests
Contributions are welcome! Feel free to fork the project, create new branches, and submit pull requests. If you encounter issues or have ideas for improvements, open an issue!
This project is open source and distributed under the MIT License. However, it is intended for learning purposes only. Use it at your own responsibility, especially if adapting it for real-world applications.
DISCLAIMER: The maintainers are not responsible for any issues, security flaws, or data losses resulting from the use of this code.