follow the below steps:
virtualenv -p python3 env
source env/bin/activae
python manage.py migrate
python manage.py createsuperuser
username:admin
password:admin
python manage.py runserver 127.0.0.1:8000run tests(test_views , test_models)
python manage.py test
''' 127.0.0.1:8000/admin/ '''
for using APIs login and receive an access token
curl -X post http://127.0.0.1:8000/api/token/ -d username=admin -d password=admin
Answer is Json with two values refresh and access select access.(this token will expire after 5 mins) refresh is used for getting new access token(refresh will expire after 24 hours)
curl -X post http://127.0.0.1:8000/api/book/ -H "Content-Type: application/json ,Authorization: Bearer MYTOKEN" -d '{"name":"xyz","price":"xyz", "author":"xyz", "publisher":"xyz"}'
curl -X get http://127.0.0.1:8000/api/book/ -H "Authorization: Bearer MYTOKEN"
curl -X get http://127.0.0.1:8000/api/book/id/ -H "Authorization: Bearer MYTOKEN"
curl -X delete http://127.0.0.1:8000/api/rating/id/ -H "Content-Type: application/json ,Authorization: Bearer MYTOKEN"
curl -X post http://127.0.0.1:8000/api/rating/ -H "Content-Type: application/json ,Authorization: Bearer MYTOKEN" -d '{"user"="xyz", "book"="xyz", "rating":"yxz"}'
curl -X get http://127.0.0.1:8000/api/rating/ -H "Authorization: Bearer MYTOKEN"
curl -X get http://127.0.0.1:8000/api/rating/id/ -H "Authorization: Bearer MYTOKEN"
curl -X delete http://127.0.0.1:8000/api/stock/id/ -H "Content-Type: application/json ,Authorization: Bearer MYTOKEN"
curl -X post http://127.0.0.1:8000/api/stock/ -H "Content-Type: application/json ,Authorization: Bearer MYTOKEN" -d '{"book":"xyz","in_stock":"xyz","quantity":"xyz"}'
curl -X get http://127.0.0.1:8000/api/stock/id/ -H "Authorization: Bearer MYTOKEN"
curl -X get http://127.0.0.1:8000/api/stock/ -H "Authorization: Bearer MYTOKEN"