The project aims to study Django and Django Rest Framework in a pratical context.
- GET, POST, DELETE and PUT data with API
Go to the project folder (cd .../fruit-api-django/
) with your terminal and type:
sudo apt install python3-virtualenv
virtualenv env
source env/bin/activate
pip install django
pip install djangorestframework
python3 manage.py runserver
The project will run in localhost (http://127.0.0.1:8000/).
To see all the data, just make a request with the endpoint http://127.0.0.1:8000/fruits/ or http://127.0.0.1:8000/regions/.
To change or delete, just pass the id in the endpoint (http://127.0.0.1:8000/fruits/id/) and in the body (json) fill in with the text you want to change, such as the fruit name. If you want to delete, just fill the id in the endpoint.