This is a Flask template for building large-scale projects with a modern folder structure and CRUD (Create, Read, Update, Delete) functionality. It provides a solid foundation for developing web applications with Flask.
- Modern folder structure for better organization and scalability
- CRUD functionality for managing data
- Flask-SQLAlchemy for interacting with the database
- Flask-WTF for handling forms and validation
- Flask-Login for user authentication and session management
- Flask-Migrate for database migrations
- Flask-Bcrypt for password hashing
- Flask-RESTful for building RESTful APIs
- Flask-CORS for handling Cross-Origin Resource Sharing
- Flask-Testing for unit testing
- Bootstrap for responsive and mobile-first design
- Jinja2 templating engine for dynamic HTML rendering
The template follows a modular structure to keep the codebase organized and maintainable. Here's an overview of the main folders and their purposes:
app
: Contains the core application codemodels
: Defines the database models using Flask-SQLAlchemyviews
: Implements the routes and views for handling HTTP requestsforms
: Contains the form classes for user input validationtemplates
: Stores the HTML templates for rendering dynamic contentstatic
: Holds static files such as CSS, JavaScript, and images
migrations
: Manages database migrations using Flask-Migratetests
: Contains unit tests for the applicationconfig.py
: Stores configuration variables for the applicationrun.py
: Entry point for running the application
To use this template, follow these steps:
- Clone the repository:
git clone https://github.com/your-repo.git
- Install the required dependencies:
pip install -r requirements.txt
- Configure the application settings in
config.py
- Create the database:
flask db init && flask db migrate && flask db upgrade
- Run the application:
python run.py
Once the application is running, you can access it in your web browser at http://localhost:5000
. The template provides a basic user interface for creating, reading, updating, and deleting data. You can customize and extend the functionality according to your project requirements.
To run the unit tests, use the following command: python -m unittest discover -s tests
If you find any issues or have suggestions for improvements, please feel free to contribute by submitting a pull request or creating an issue on the GitHub repository.
This template is open-source and released under the MIT License. Feel free to use it for your personal or commercial projects.
This template was inspired by best practices and recommendations from the Flask community. Special thanks to all the contributors who have made this template possible.
If you have any questions or need further assistance, you can reach out to the project maintainer at [email protected]
Happy coding!