A django project implementing REST API with customized webpage UI.
Report Bug
·
Request Feature
Table of Contents
Django is a very popular web framework for developing websites and web apps. This project is a task given by the company STRATIV to me for evaluating my Django and Python knowledge.
Through this project:
- You will be able to learn how to design django UI.
- You will learn how to code & run Custom Management Commands in Django.
- You will be able to implement custom made REST API in django projects.
- You will be able to make user authentication & API token authentication.
A list of commonly used resources that I find helpful are listed in the acknowledgements.
To get started with this project to run locally follow the steps below. After that you will be ready to go.
Please clone the repo using the following command in your git bash. Or you choose to use the Clone option at the top right corner of this page to copy the link and clone it into your IDE directly.
- Clone the repo
git clone https://github.com/AR-Ashraf/Django-REST-API-Website.git
Open the project from your cloned directory in Pycharm. [Make sure you have installed the Django module from setting->python interpreter->add module]
-
Install Python 3.9 and Pip3 in your device and then run the following command to install django
pip install Django
pip install djangorestframework # For implement REST API pip install markdown # Markdown support for the browsable API. pip install django-filter # Filtering support
-
Now run the following command to install necessary libraries
pip install requests pip install pillow
-
Now go to the project terminal of pycharm and run the following commands
python manage.py makemigrations python manage.py migrate
-
Now create super user to access the admin dashboard by running following commands
python manage.py createsuperuser
Provide your admin username, email & password. These credentials will be used to access the admin dashboard.
-
Now run your local server to launch the website by running following command
python manage.py runserver
You will see a ip url in the terminal: http://127.0.0.1:8000/ Copy this url and paste it in your browser. You will be redirected to a Login page. Please Sign Up as a new user so that you can be authenticated and get into the main dashboard of the project. After Registration, enjoy the website!
Available API are
1) List of all countries: http://127.0.0.1:8000/api/country/list
2) Detail of a specific country: http://127.0.0.1:8000/api/country/list?search=<country_name>
3) Create a new country: http://127.0.0.1:8000/api/country/create
4) Update an existing country: http://127.0.0.1:8000/api/country/<country_name>/update
5) Delete an existing country: http://127.0.0.1:8000/api/country/<country_name>/delete
6) Searching a country by partial name: http://127.0.0.1:8000/api/country/list?search=<partial_country_name>
To access these API, run postman in your local machine. There provide your username & password in the form-data section of Body tab. Using these you need to retrieve your access token.
http://127.0.0.1:8000/api/token/auth/
Use this url in the GET method of postman and you will get a token in the result field. Then go to the Header tab and chose Authorizatoin as credential and paste your token inside the value field.
Token <Your-Token>
Provide the token in the value field like this way. Now use those api urls and send requests & enjoy this project.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Dev Branch (
git checkout -b dev/Django-REST-API-Website
) - Commit your Changes (
git commit -m 'Add some Django API Feature'
) - Push to the Branch (
git push origin dev/Django-REST-API-Website
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
LinkedIn - Ashraful Islam - Send me a connection request and let's get to know each other.
My Other Projects: Projects