This project is a template application designed for backend API development using Flask.
-
Clone this project:
git clone https://github.com/username/project-name.git cd project-name
-
Create and activate a virtual environment:
python -m venv venv .\venv\Scripts\activate # Windows source venv/bin/activate # MacOS/Linux
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the application:
flask run
-
Test the API using your browser or a tool like Postman:
GET /api/v1/resource
: Example of a GET request.POST /api/v1/resource
: Example of a POST request.
This project includes several CLI commands to manage database migrations.
-
Initialize the database:
python db_cli.py init
This command initializes the database for migrations.
-
Create a new migration:
python db_cli.py migrate --message "your migration message"
This command creates a new migration with the specified message. The default message is "migration".
-
Apply the latest migrations:
python db_cli.py upgrade
This command applies all the latest migrations to the database.
-
Downgrade the database:
python db_cli.py downgrade --revision "revision_id"
This command downgrades the database to the specified revision. The default is one step back.
If you would like to contribute, please open an issue first. Submit your changes via a pull request.
- Fork the project (click the Fork button at the top right)
- Create a new branch (
git checkout -b new-feature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push the branch (
git push origin new-feature
) - Open a pull request
This project is licensed under the MIT License. For more information, see the LICENSE
file.