Install postgresql to you machine Install python3.8 or above in your local and set that as global python3 version
pip install virtualenvwrapper
git clone [email protected]:egemenberk/To-Do-list.git
cd To-Do-list
mkvirtualenv todo-list-api -p $(which python3) -r requirements.txt
setvirtualenvproject
export FLASK_APP=todo_app/app.py
psql
create database todo_list;
exit
python
from todo_app.models import db
from wsgi import app
with app.app_context():
db.create_all()
chmod +x run.sh
./run.sh
Open http://127.0.0.1:5000/ui/ and test the app by first creating a user via ui
First, create an account and create an app
heroku addons:create heroku-postgresql:hobby-dev --app <APP_NAME_HERE>
heroku run python
Then create tables in remote database as well by doing steps in here
Open deployed example app from here, it is free tier, it will stop after it is being used a lot.
- Create user
- Authorize yourself
- Use the APIs
pytest tests/
- For easiness of usage, swagger UI is enabled by default, swagger UI can have its own db and run on another machine seperated from real API service
- requirements.txt does not include versions, which might introduce dependency issues later on
- Integration of factory classes with database is problematic, fix that to utilize testing tools better