AR-Ashraf / Django-REST-API-Website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License LinkedIn


Django REST API Website for STRATIV

A django project implementing REST API with customized webpage UI.

Report Bug · Request Feature

Screenshot 2021-08-20 023015

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

Screenshot 2021-08-20 023050

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.

Built With

Getting Started

To get started with this project to run locally follow the steps below. After that you will be ready to go.

Prerequisites

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]

Installation

  1. 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
  2. Now run the following command to install necessary libraries

    pip install requests
    pip install pillow
  3. Now go to the project terminal of pycharm and run the following commands

    python manage.py makemigrations
    python manage.py migrate
  4. 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.

  5. 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!

API

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.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contribution

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.

  1. Fork the Project
  2. Create your Dev Branch (git checkout -b dev/Django-REST-API-Website)
  3. Commit your Changes (git commit -m 'Add some Django API Feature')
  4. Push to the Branch (git push origin dev/Django-REST-API-Website)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

LinkedIn - Ashraful Islam - Send me a connection request and let's get to know each other.

My Other Projects: Projects

Acknowledgements

About

License:MIT License


Languages

Language:Python 96.7%Language:HTML 1.4%Language:JavaScript 0.9%Language:CSS 0.8%Language:PowerShell 0.1%Language:Batchfile 0.0%