This is the API that powers OpenEats. It uses Django/Django Rest Framework to power the API. The core responsibilities of the APi are:
- OpenEats REST API
- Django User management with Django REST token auth
- Django Admin panel for creating new users and administration
- Static Media Manangemtn (AKA Recipe Images)
See the homepage for more information about OpenEats!
Please read the contribution guidelines in order to make the contribution process easy and effective for everyone involved.
To run tests locally:
cd openeats-web
docker-compose -f test.yml -p test build
docker-compose -f test.yml -p test up -d db
docker-compose -f test.yml -p test run --rm --entrypoint sh api
python manage.py test
Note: If this is the first time you are running the tests, give the DB some time to build itself once it's build there is no need to wait again.
You can access the API roots via there app names:
- Recipes - http://localhost:8000/api/v1/recipe
- Ingredients - http://localhost:8000/api/v1/ingredient/
- Recipe groups - http://localhost:8000/api/v1/recipe_groups/
- News - http://localhost:8000/api/v1/news/
- Lists - http://localhost:8000/api/v1/list/
- install postgres
- create user and database in postgres - brief linux command help:
sudo -u postgres createuser --interactive
sudo -u postgres psql
ALTER USER user_name WITH PASSWORD 'new_password';
CREATE DATABASE openeats;
- update base/settings.py with DB credentials (step above)
- install python 3 if needed
- install pip if needed
- install virtualenv wrapper (sometimes vewrapper needs some extra tweaking - ref: https://bit.ly/33ZCngc)
mkvirtualenv openeats
workon openeats
pip install base\requirements.txt
python manage.py createsuperuser --username admin --email [email protected]
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
- api should then be available at: 127.0.0.1:8000/api/v1/recipe/
- admin should then be available at: 127.0.0.1:8000/admin