Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yamila-moreno/api-example

API example
https://github.com/yamila-moreno/api-example

Last synced: 4 days ago
JSON representation

API example

Awesome Lists containing this project

README

        

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)
* 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
```