FlaskMason
FlaskMason is a command-line tool designed to quickly scaffold Flask applications with a Django-like project structure. It automates the creation of a boilerplate project with organized blueprints, configuration files, and other essential components, allowing developers to focus on building features instead of setting up their environment.
Features
- Django-like Folder Structure: Automatically creates a structured layout for your Flask projects, including blueprints for authentication, admin, and more.
- Predefined Boilerplate Code: Generates essential files with predefined content, reducing the need for repetitive setup.
- Easy Installation: Installs all necessary dependencies with a single command.
Installation
You can install FlaskMason via pip. To install it along with its dependencies, run:
pip install flaskmason
Usage
To create a new Flask project, simply run:
flaskmason <project_name>
This command will generate a new directory called <project_name>
containing the following structure:
<project_name>/
├── app.py
├── config.py
├── requirements.txt
├── .env
├── blueprints/
│ ├── __init__.py
│ ├── auth/
│ │ ├── __init__.py
│ │ ├── views.py
│ │ ├── models.py
│ │ └── forms.py
│ └── admin/
│ ├── __init__.py
│ ├── views.py
│ ├── models.py
│ └── forms.py
├── static/
└── templates/
Example Commands
- Create a new Flask project:
flaskmason my_flask_project
- Change directory into the new project:
cd my_flask_project
- Run the application:
python app.py
File Descriptions
- app.py: The main application file where the Flask app is created and configured.
- config.py: Contains configuration settings for the application, such as database URI and secret keys.
- blueprints/: Directory for organizing application features into blueprints, improving modularity and maintainability.
- static/: Directory for static files (CSS, JavaScript, images).
- templates/: Directory for HTML templates used in rendering views.
Contributing
Contributions are welcome! If you have suggestions or find bugs, please open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/YourFeature
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a pull request.
Author
Acknowledgements
Thanks to the Flask community for providing an excellent framework for web development.