I ma creating this project and learning the django rest framework
- Clone the project
- Create a virtual environment using
python3 -m venv env
- Actiivate the virtual environment using
source env/bin/activate
- Install the requirements using
pip install -r requirements.txt
- Run the command
python manage.py makemigrations
to create the migrations - Then run the command
python manage.py migrate
to apply the migrations - Now are ready to run the server using
python manage.py runserver
Request:
POST
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Path:
http://127.0.0.1:8000/account/login/
Request:
POST
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
When you register your account at that time your
token
will be generated automatically and you will be not be registred as admin if you login from this endpoint so if you want to be admin user then you need to run command aspython manage.py createsuperuser
and then login from thelogin
endpoint then you will get token related to admin user and you can access all endpoints which are made for normal users and admin users.Path:
http://127.0.0.1:8000/account/register/
Request:
POST
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
When you logout the user your token will be deleted and you will not be able to access any endpoints which are made for normal users and admin users. To access them again you need to login
Path:
http://127.0.0.1:8000/account/logout/
Request:
POST(if admin user)
&GET(if normal user or not logged in)
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
In this endpoint you can see all the list even if you are not admin or not logged in.
Path:
http://127.0.0.1:8000/watch/list/
Request:
POST(if you are normal user or admin)
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Now here
<int:pk>
this means that you need to write the movie id which you want to review.Path:
http://127.0.0.1:8000/watch/<int:pk>/review-create/
Request:
GET(If User is logged in)
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Now here
<int:pk>
this means that you need to write the movie id which you want to see all the reviews related to that movie only.Path:
http://127.0.0.1:8000/watch/<int:pk>/reviews/
Request:
GET
,PUT
,DELETE
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Now here
<int:pk>
this means that you need to write the review id which you want to see orupdate
ordelete
that review.Path:
http://127.0.0.1:8000/watch/review/<int:pk>/
Request:
GET
,PUT
,DELETE
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Now here
<int:pk>
this means that you need to write the movie id which you want to see orupdate
ordelete
that review.Path:
http://127.0.0.1:8000/watch/<int:pk>
Request:
POST(if admin user)
&GET(if normal user)
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Use the token that was created when you logged in and you must be
ADMIN
to create a Stream platformPath:
http://127.0.0.1:8000/watch/stream/
Request:
POST(if admin user)
&GET(if normal user)
Use this endpoint in any client software like
postman
orThunder client(in vscode)
to generate aToken
Use the token that was created when you logged in and you must be
ADMIN
to create a Stream platformPath:
http://127.0.0.1:8000/watch/list/