Skip to content

TechNinjass/midall-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MidAll - Back-end Project

This is built with Flask, Flask-RESTful and Flask-SQLAlchemy.

Pre-requirements

Recommended IDEAs

The IDE must load the Python packages from venv

Environment Settings

Step 1

  • Into the local repository folder, run:
python -m venv venv
  • After activate the Python venv
source venv/Scripts/activate
  • Update pip package
python -m pip install -U pip

Step 2

  • Installing the Python project's dependency packages
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt

Important Notes

  • If new or updated dependency package was added in the project structure, the requirements.txt must be updated
pip freeze > requirements.txt

Executing Database Migrations using Flask-Migrate

For you to control changes in the database follow the instructions below:

  1. Open the "flaskr" folder in console with following command:
cd flaskr
  1. Create a migration repository. If the migrations folder already exists this command is not necessary.
  python -m flask db init
  1. To build a new migration, for example, "Initial migration"
  python -m flask db migrate -m "Initial migration."
  1. Then you can apply the migration to the database:
  python -m flask db upgrade

Notes: To see all the commands that are available run this command:

  python -m flask db --help

Official documentation for Flask-Migrate

Set paths and values in application

Before run the statements below, edit the value of parameter FLASKR_DEV_DIR in the .env file of the docker folder with the absolute path of flaskr/ project folder in you host and declare absolute path of cloud folder in config_credentials.py file

Running Flask back-end via docker-compose

Start all back-end via docker-compose

cd docker
docker-compose build --no-cache
docker-compose up --force-recreate -d ; docker-compose logs -f

To stop docker docker-compose

# In the project root folder
cd docker
docker-compose down --remove-orphans

Run application for development

  1. Declare as variable for debugging
export FLASK_ENV=development
export FLASK_APP=app.py

2.Enter the flaskr folder and run

cd flaskr
flask run

About

Back-end project using Flask and Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published