-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation Backend
These docs are for the backend folder i.e. the Django Project.
If you are looking for some other docs, then please refer here.
The backend folder is a Django Project called "backend"
The project structure for the Django App (backend) is shown below:
.
βββ backend # Django Project called "backend"
β ββ __init__.py
β ββ asgi.py
β ββ settings.py
β ββ urls.py
| ββ wsgi.py
|
βββ eatit # Django app called "eatit"
β ββ api # A separate folder of API to deal with the API requests
β β ββ __init__.py
β β ββ serializers.py # Functions to serialize python data
β β ββ urls.py # API endpoints
β β ββ views.py # View functions for the corresponding URL's
β ββ migrations
β β ββ ...
β ββ __init__.py
β ββ admin.py
β ββ apps.py
β ββ models.py # Models for the "eatit" app
β ββ tests.py # Tests for the "eatit" app
| ββ views.py
|
βββ restaurants # Django app called "restaurants"
β ββ api # A separate folder of API to deal with the API requests
β β ββ __init__.py
β β ββ serializers.py # Functions to serialize python data
β β ββ urls.py # API endpoints
β β ββ views.py # View functions for the corresponding URL's
β ββ migrations
β β ββ ...
β ββ __init__.py
β ββ admin.py
β ββ apps.py
β ββ models.py # Models for the "restaurants" app
β ββ tests.py # Tests for the "restaurants" app
| ββ views.py
|
βββ example.env # env file without credentials
βββ manage.py # Standard Django project's file
βββ Procfile # For Heroku deployment
βββ requirements.txt # Contains all the dependencies
This Django Project has 2 apps, namely eatit and restaurants.
The eatit app is responsible for the end users, the one's who browse through the food items, and purchase them.
The restaurants app is responsible for the restaurant owners, the one's who partner with us, and list their food items on our platforms, and receive payments on selling them.
You will notice that there is a new folder called api in addition to the standard Django's App files.
This folder is responsible for all the API endpoints.
urls.py - This file defines all the API endpoints for the "eatit" app
views.py - This file specifies the view functions for the corresponding URL routes
serializers.py - This file contains classes to serialize the current data in Python objects into JSON objects
DRF is used in the backend while User authentication is done using JWT. Various API endpoints are defined in the url.py file, whereas the corresponding view functions are available in the views.py file. View functions perform the required backend operations and then return the data to the frontend in a JSON format. The data conversion, from Python objects to JSON objects, is done using serializers available in serializers.py file
You will notice that there is a new folder called api in addition to the standard Django's App files.
This folder is responsible for all the API endpoints.
urls.py - This file defines all the API endpoints for the "restaurants" app
views.py - This file specifies the view functions for the corresponding URL routes
serializers.py - This file contains classes to serialize the current data in Python objects into JSON objects
DRF is used in the backend while User authentication is done using JWT. Various API endpoints are defined in the url.py file, whereas the corresponding view functions are available in the views.py file. View functions perform the required backend operations and then return the data to the frontend in a JSON format. The data conversion, from Python objects to JSON objects, is done using serializers available in serializers.py file