Starting point for Day 4 of Python API Week.

pipenv install --dev
pipenv run nosetests

Don't forget to apply migrations if you just forked the git repository :

pipenv run python manage.py db upgrade

👉 Previously, you should have manually created a flask_db and a flask_db_test databases like so:

For a windows environment, in a gitbash terminal :

winpty psql -U postgres -c "CREATE DATABASE flask_db"
winpty psql -U postgres -c "CREATE DATABASE flask_db_test"

For an unix environment, in a terminal :

psql -U postgres -c "CREATE DATABASE flask_db"
psql -U postgres -c "CREATE DATABASE flask_db_test"

👉 Don't forget to create a .env file in your project folder, then add your DATABASE_URL as previously:

DATABASE_URL="postgresql://postgres:<password_if_necessary>@localhost/flask_db"

Ex:

DATABASE_URL=postgresql://postgres:root@localhost/flask_db

👉 To launch the api :

FLASK_ENV=development pipenv run flask run

👉 localhost:5000 for Swagger documentation.