.. project-description-start
An API built to serve two purposes:
- Serving user location data for use in a map
- Allowing message exchange between users and clients
A proven example use case is listing locations of sellers on a hyperlocal map, and allowing customers (clients) to request a callback phonecall from a user of their choice. A fully working system requires an additional way of relying messages to and from users, that is implemented as a webhook. The webhook is called by the User Location API.
.. project-description-end
API reference is available in the project docs.
To run locally, do
cp .env.sample .env
docker-compose up --build
A local testing interface should be available at http://localhost:5000.
Sign upp for an heroku account, download the heroku CLI and log in.
heroku create --region eu <myapp>
heroku addons:create heroku-redis:hobby-dev
To set the configuration variables,
heroku config:set BASIC_AUTH_USERNAME=<myusername>
heroku config:set BASIC_AUTH_PASSWORD=<mypassword>
heroku config:set FLASK_SECRET_KEY=<mysecretkey>
heroku config:set SALT=<mysecretsalt>
heroku config:set WEBHOOK_URL=<mymessagewebhookurl>
heroku config:set CORS_ORIGINS=http://mywebsite.com,localhost:5000
Most of these can be chosen arbitrarily, as long as they are sufficiently long.
Set the remote url.
heroku git:remote -a <myapp>
Deploy to heroku.
git push heroku master
Wait until deployment has succeeded (failed).
Check if it works.
curl "https://<myapp>.herokuapp.com/locations"
Install dev-dependencies
pipenv install --dev
Lint your code (PEP8)
pipenv run lint
Run tests
pipenv run pytest
Generate docs (local)
cd docsrc/;pipenv run make html
Generate docs (build)
cd docsrc/;pipenv run make github