Flask Boilerplate to quickly get started with production grade flask application with some additional packages and configuration prebuilt.
- Python 3.6 or higher
- PostgreSQL
- Docker(optional)
# clone the repo
$ git clone https://github.com/yezz123/Nectus.git
# move to the project folder
$ cd Nectus
- Using virtualenv 📦
- Create a
virtual environment
for this project 📦
# creating virtual environment
$ virtualenv venv
# activating the virtual environment
$ source venv/bin/activate
# installing dependencies
$ pip install -r requirements.txt
- Create a
.env
file from.env.sample
and set appropriate environment variables before running the project
# Database configuration
DB_HOST=
DB_Name=
DB_USERNAME=
DB_PASSWORD=
DB_PORT=
# JWT configuration
JWT_SECRET_KEY=
UPLOAD_FOLDER =
# APP configuration
HOST=
PORT=
# Flask configuration
FLASK_APP=main.py
FLASK_ENV=development
NOTE: The Pre-configured environment variables are for using Docker.
-
Make sure the database name username, password and host have been set in the env
-
Migrate and upgrade database into your database management (for this case postgreeSQL)
flask db init
flask db migrate -m "create new table"
flask db upgrade
- If you feel that everything can be run, then run the Flask API
flask run
- We have the Dockerfile created in above section. Now, we will use the Dockerfile to create the image of the Flask app and then start the application container.
- I provide a simplified way by Using a Pre-configured
Makefile
just write in your CLImake help
and use the commands.
Note: About the preconfigured .env.sample
, i use it to pass all checks relate to Github Actions, you could check both the Docker-compose.yml and Build.yml.
Includes preconfigured packages to kick start flask app by just setting appropriate configuration.
Package | Usage |
---|---|
flask-cors | Configuring CORS |
PyJWT | Python library which allows you to encode and decode JSON Web Tokens (JWT). |
This project is licensed under the terms of the MIT license.