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.
|
|
6 years ago | |
|---|---|---|
| .circleci | 6 years ago | |
| conduit | 6 years ago | |
| migrations | 6 years ago | |
| requirements | 6 years ago | |
| tests | 6 years ago | |
| .env | 6 years ago | |
| .gitignore | 6 years ago | |
| LICENSE | 6 years ago | |
| Pipfile | 6 years ago | |
| Pipfile.lock | 6 years ago | |
| Procfile | 6 years ago | |
| Readme.md | 6 years ago | |
| Vagrantfile | 6 years ago | |
| autoapp.py | 6 years ago | |
| image.png | 6 years ago | |
| requirements.txt | 6 years ago | |
| setup.cfg | 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