(sending emails everyday at 10 a.m.)
(no third party email service specified, requires configuration)
https://github.com/axnsan12/drf-yasg
https://kamhaj-emenu-app.herokuapp.com/swagger/
model Dish:
GET methods - no authorization
POST, PUT, DELETE - Token authorization
- GET - to get Dish details
- GET - to get Dishes list
- POST - to create Dish object, ImageField included, Django Parsers used
- PUT - to update Dish fields, ImageField included, Django Parsers used
- DELETE - to delete Dish
model Menu:
GET methods - no authorization
POST, PUT, DELETE - Token authorization
- GET - to get Menu details
- GET - to get Menus list (non empty, meaning - with at least one Dish)
- POST - to create Menu object, Dish objects added by specifying a list of their IDs
(e.g. dishes: [{"pk":1}, {"pk": 3}, {"pk": 6}] ) - PUT - to update Menu fields, Dish objects added by specifying a list of their IDs
(e.g. dishes: [{"pk":1}, {"pk": 3}, {"pk": 7}]. Old dishes will be removed). - DELETE - to delete Menu
- Click "Authorize" button
- Provide "Token <token_value>"
- Clone repo
- Set up virtual environment (venv) and activate it
virtualenv venv
venv\Scripts\activate (Windows)
- Install required libraries
pip install -r requirements.txt
- Run Redis service (in CMD) to store/process tasks (download from here: https://github.com/ServiceStack/redis-windows)
redis-server.exe redis.windows.conf
- Run a Celery worker (in separate CMD) to pick up tasks (sample task invoked every minute was provided for testing purposes)
celery -A restaurant worker -l INFO
- Run app on localhost and access it in a broswer (localhost:8000)
python manage.py runserver
coverage run --source='.' manage.py test
coverage report --omit=venv/*
- Periodic task (emails sending) can be run on demand (as Django custom command)
python manage.py email-report
- API only: listing Dishes and Menus can be sorted
(by adding parameters to URL,
e.g. https://kamhaj-emenu-app.herokuapp.com/api/eMenu/dish/list_dishes/?sort=name ) - Sqlite3 db was used.
- add pagination