REST API to create, update and delete a product as defined in the task.
Classic python-flask application setup
- create and activate Python
virtualenv
(I prefer python3) - install
pip install -r requirements.txt
change ENVVARS
to fit your system (you may take inspiration from .env_example
)
export FLASK_APP=micro # for developement
export DATABASE=postgres://clerk:spersecret@localhost:5432/catalog
Or you can use dotenv
module and load .env
from base folder.
Create database using interactive Python shell with SQLAlchemy
method create_all()
>>> from micro.database import db
>>> db.create_all()
Run the application
$ flask run
Use wsgi in deployment. There is used wsgi.ini
with heroku on mockup server.
$ flask db init
$ flask db migrate