Yield generated for 45c8e6fd-2b78-46ce-b7fc-e16fda0b8009
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Johann 31c5aee35b 🔧 Modification de l'url front 6 years ago
.circleci 🚧 Premier jet back 6 years ago
conduit 🔧 Modification de l'url front 6 years ago
migrations Initial commit 6 years ago
requirements Initial commit 6 years ago
tests Initial commit 6 years ago
.gitignore Initial commit 6 years ago
Dockerfile 🚧 Premier jet back 6 years ago
LICENSE Initial commit 6 years ago
Pipfile Initial commit 6 years ago
Pipfile.lock 🚧 Premier jet back 6 years ago
Procfile 🚧 Premier jet back 6 years ago
Readme.md Initial commit 6 years ago
Vagrantfile Initial commit 6 years ago
autoapp.py Initial commit 6 years ago
image.png Initial commit 6 years ago
requirements.txt Initial commit 6 years ago
setup.cfg Initial commit 6 years ago

Readme.md

Install

Before running shell commands, set the CONDUIT_SECRET, FLASK_APP and FLASK_DEBUG environment variables :

export CONDUIT_SECRET='something-really-secret'
export FLASK_APP=/path/to/autoapp.py
export FLASK_DEBUG=1
  • be sure to have python 3+
  • have postgresql installed on your machine
  • pip install -r requirements/dev.txt --user

Applying db schema :

flask db init
flask db migrate
flask db upgrade

Whenever a database migration needs to be made. Run the following commands

flask db migrate

This will generate a new migration script. Then run flask db upgrade

To apply the migration.

For a full migration command reference, run flask db --help.

Running tests with docker :

docker container run --name flask_db_test -e POSTGRES_PASSWORD=somePwd -e POSTGRES_USER=myUsr -p 5432:5432 -d postgres
sleep 1
export DATABASE_URL=postgresql://myUsr:somePwd@localhost:5432/myUsr
flask db upgrade
flask test
docker container stop flask_db_test
docker container rm flask_db_test
unset DATABASE_URL

Usage in prod :

gunicorn autoapp:app -b 0.0.0.0:$PORT -w 3

Shell

To open the interactive shell, run flask shell.

By default, you will have access to the flask app and models.

Dev

In your production environment, make sure the FLASK_DEBUG environment variable is unset or is set to 0, so that ProdConfig is used, and set DATABASE_URL which is your postgresql URI like for example postgresql://localhost/example