A simple Flask app creator
Project description
Flask Ignite
A simple Flask app creator that automatically generates a basic Flask project structure including models, routes, services, configuration, and more.
Getting Started
This repository contains a utility package that, once installed, provides a CLI command to create a Flask project structure automatically. The command is registered as a console script named flask-admin
.
Prerequisites
- Python 3.7 or higher
- Flask
- Flask-SQLAlchemy
- Flask-Migrate
- python-dotenv
Setup and Usage
-
Clone the Repository
Clone this repository to your local machine.
-
Install the Package
From the root of the repository, install the package locally:
pip install flask-ignite
-
Run the Project Setup Command
Execute the following command to generate the Flask project structure:
flask-ignite --project <your_project_name> # defaults to flask_app
This will create a project structure similar to the following:
- flask_app/
- app/
- models/
__init__.py
user.py
post.py
- routes/
__init__.py
user_routes.py
post_routes.py
- services/
__init__.py
user_service.py
- config/
__init__.py
settings.py
extensions.py
__init__.py
- models/
- migrations/
.env
config.py
requirements.txt
wsgi.py
run.py
- app/
- flask_app/
-
Next Steps
After generating the project, follow these steps:
-
Navigate into the generated project directory:
cd flask_app
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows:
venv\Scripts\activate
- Mac/Linux:
source venv/bin/activate
- Windows:
-
Install the project dependencies:
pip install -r requirements.txt
-
Initialize the database:
flask db init && flask db migrate -m "Initial migration" && flask db upgrade
-
Run the app:
python run.py
-
Project Structure Overview
- app/models: Contains database models (e.g.,
User
andPost
defined inuser.py
andpost.py
). - app/routes: Defines routes using Blueprints for handling API endpoints (in
user_routes.py
andpost_routes.py
). - app/services: Holds service functions for data manipulation or retrieval (in
user_service.py
). - app/config: Stores configuration settings and environment-specific variables (in
settings.py
). - app/extensions.py: Initializes Flask extensions like SQLAlchemy and Migrate.
- app/init.py: Creates and configures the Flask application.
License
This project is licensed under the MIT License.
Author
Nahom D
Email: nahom@nahom.eu.org
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flask_ignite-0.1.4.tar.gz
.
File metadata
- Download URL: flask_ignite-0.1.4.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
53fa93db81cfe721684d33e812b420bfa2ce8c1cd5ba76dda0c4cb0c81cb5249
|
|
MD5 |
3c444893d50071db5254de303b77e00f
|
|
BLAKE2b-256 |
0293ce6b3c2462cb7a4ddd23f5434a0eddec2138b0d675a3f77c7c9034f67583
|
File details
Details for the file flask_ignite-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: flask_ignite-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
898f0c290c51873438cc1e08f422a43007766943e00e2b4b1150f456e4c4c72d
|
|
MD5 |
0dbd4dc9cbe0ba8be612a7f75c975780
|
|
BLAKE2b-256 |
dfe0d3b7093d936ccfd7afd2077894875edf9bd9f0d5014ef08af96e8a1da978
|