API Example
It's a very simple API made with Anillo and Python. To get ready with your environment:
- You need to copy myapp.ini and pytest.ini files outside the repository
- You need to export two env vars: MY_APP and MY_APP_TEST, pointing the previous files
- You need sqlite (usually it's in all Linux)
- You need redis >= 2.8.0
- I encourage you to use a virtualenv (with Python3!!!)
- You need to install requirements.txt and requirements-server.txt
Note: if you're not using postgres (not mandatory!), you don't need to install psycopg2 (which is in requirements.txt
)
Once you've all of this, you can run the API locally directly with Anillo:
(myvenv) src/ $ python run.py serve --create-db --with-fixtures --no-hot-reload
Or, if you installed requirements-server.txt, you can run the application with Gunicorn:
(myvenv) src/ $ gunicorn -b 0.0.0.0:5005 --access-logfile - --error-logfile - --log-level debug 'wsgi:load_application("create-db", "with-fixtures")'
And you can run the tests:
(myvenv) src/ $ python run.py test