This app allows people to order groceries online
Firstly, create virtual environment.
python3 -m venv venv
Then activate it.
For Windows:
venv\Scripts\activate.bat
For Linux or MacOS:
source venv/bin/activate
Install requirements
pip install -r requirements.txt
This project has it's own telegram bot to communicate with delivery men.
It has 4 commands:
name | description |
---|---|
/start | Sends a welcome message to courier with ID This ID should be sent to a manager |
/start_day | A command to start a working day After pressing this button, courier will start getting messages with new orders |
/end_day | A command to finish a working day After pressing this button, courier will finish getting messages with new orders |
/end_order | Pressing this button means that courier has finished a delivery and he or she is ready to get messages with new orders |
You can create a telegram bot using BotFather
After creating it, BotFather should return you a token for your future tg bot
Create .env file for variable environment in main directory
Add in .env file next variables:
Don't forget to migrate the project
python3 manage.py makemigrations
python3 manage.py migrate
The last step: running it all
python3 manage.py runserver
python3 manage.py runbot
Congrats!
Now you can use the project!
Here are commands for REST API:
name | type | description |
---|---|---|
/auth/login/ | POST | sends a token to an existing user |
/auth/register/ | POST | signs up a new user and sends a token to them |
/core/categories/ | GET | shows categories of items |
/core/categories/{id}/ | GET | detail information about category |
/core/categories/{id}/items/ | GET | shows items in a chosen category |
/core/items/ | GET | shows all items (only items in stock) |
/core/items/{id} | GET | detail information about item (only items in stock) |
name | type | description |
---|---|---|
/auth/user/ | GET | shows detail information about user |
/auth/user/ | PUT, PATCH | updates detail information about user |
/orders/user_finished_orders/ | GET | shows all user's finished orders |
/orders/user_finished_orders/{id} | GET | detail information about finished order |
/orders/user_orders/ | GET | shows all user's not finished orders |
/orders/user_orders/ | POST | creates a new order of user |
/orders/user_orders/{id} | GET | detail information about not finished order |
/orders/user_orders/{id} | PUT, PATCH | update detail information about not finished order |
/orders/user_orders/{id} | DELETE | delete not completed order |
/orders/user_orders/{id}/to_order/ | PATCH | marks order as completed, sends an information about order to one of couriers |
name | type | description |
---|---|---|
/auth/user_list/ | GET | shows all users |
/core/admin_categories/ | POST | creates a new category |
/core/admin_categories/{id} | PUT, PATCH | updates a category |
/core/admin_categories/ | DELETE | deletes a category |
/core/admin_items/ | GET | shows all items (including items out of stock) |
/core/admin_items/ | POST | creates a new item |
/core/admin_items/{id} | GET | detail information about item (including items out of stock) |
/core/admin_items/ | PUT, PATCH | updates an item |
/core/admin_items/ | DELETE | deletes an item |
/core/admin_items/{id}/set_in_stock/ | PATCH | marks item as 'in stock' |
/core/admin_items/{id}/unset_in_stock/ | PATCH | unmarks item as 'in stock' |
/employees/couriers/ | GET | shows all delivery men |
/employees/couriers/ | POST | registers a new delivery man |
/employees/couriers/{id} | GET | detail information about a delivery man |
/employees/couriers/{id} | PUT, PATCH | updates information about a delivery man |
/employees/couriers/{id} | DELETE | deletes a delivery man |
/orders/all_orders/ | GET | shows all orders |
/orders/all_orders/{id} | GET | shows detail information about an order |