Flask Project Structure
A scalable and maintainable folder structure for Flask applications
File Structure
- myflaskapp
- __init__.py
- routes.py
- models.py
- templates
- static
- config.py
- requirements.txt
- run.py
- README.md
Directory Structure Explanation
myflaskapp/
The main application folder containing all Flask-related files.
myflaskapp/__init__.py
Initializes the Flask application and sets up the app configuration.
myflaskapp/routes.py
Defines the routes and view functions for the Flask application.
myflaskapp/models.py
Defines the database models for the application.
myflaskapp/templates/
Contains HTML templates for rendering views.
myflaskapp/static/
Stores static files like CSS, JavaScript, and images.
config.py
Contains configuration settings for the Flask app.
requirements.txt
Lists the Python dependencies required for the Flask project.
run.py
Entry point for running the Flask application during development.
README.md
Documentation file providing an overview and instructions for the project.