This is a small project to learn how to use Flask with two new libraries I just found:
The main goal is to build a generic and reusable task synchronizer that allows to manage jobs, tasks, storages, clients, and related stuff.
In the first uploaded version (0.1) it will have the most abstract concepts, almost not usable in a real scenario, but my (could be ours..) goal to reach V1.0 is to simulate a Coffee spending machine, that have flavors, cups, time to serve, a witdrawal window and such only configuring the application, through API, without specifying (hopefully) new Coffee classes.
It includes much more techonlogies, but these are the interesting ones
note: It will need another diagrams for sure.
note: The Classes Diagram still lacks of labour, it is constanly changing now, and actually does not correspond with code in a 100% but almost.
It have all the needed to be documented, thanks to OpenAPI and swagger.io⁴, after you run the application enter to: http://localhost:5000/api/spec.html#!/spec you should be able to see this:
It will be soon someday in a Heroku Test Instance
I suggest you to use virtualenv
to play with it, here is what I did:
#install python3.5 and virtualenv according with your distribution / OS
#this steps are for a unix-like system
git clone https://github.com/RafaAguilar/job-dispatcher.git
cd job-dispatcher/
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
#change dispatcher with your PostgreSQL proper data
export APP_SETTINGS="config.DevelopmentConfig" #check config.py to see the options
export DATABASE_URL="postgresql://dispatcher:dispatcher@localhost/dispatcher"
#python manage.py migrate #this only will be needed when you make changes
#and warning, flask_migrate isn't behaving
#if you have any issues read the "KnowN issues" subject.
python manage.py upgrade
#If everything goes well, just type:
python app.py
- After changing models it won't upgrade DB:
alembic
, as part offlask_migrate
doesn't recognize a bunch of outsider models, like the custom ones or the ones fromsqlalchemy_utils
for example, so you just need to add the proper updates on the generated migration. It also has a problem withJSON
fields, so you have to manually addsa.
in the migrations where there is only aText()
. This is while they fix this issue :P