Skip to content

Aashishkumar123/amazon-backend

Repository files navigation

Amazon Clone API

Amazon clone api using django and django rest framework.

Requirements

Python 3.6+

Installation

$ pip install -r requirements.txt

Database setting

Go to settings.py file and change the database settings.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'your-database-name',
        'USER': 'Your-username',
        'PASSWORD': 'Your-password',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

and then hit the migrate command to successfully create database table..

$ python manage.py migrate

Run the project

To run the project is very simple just hit this command

$ python manage.py runserver

API Documentations

If you want api documentations simple visit this

swagger docs

$ http://localhost:8000/api/amz/swagger/

ReDocs docs

$ http://localhost:8000/api/amz/redoc/

Testing

If you want to run the test cases you can simply run this command

$ python manage.py test

Hence all api testing code are wriiten in test.py file.

Code Format

If you want to format the code you can simply run those commands.

using black package

$ black amazon_backend_api/api/views.py

using flake8 package

$ flake8 amazon_backend_api/api/views.py

Postman api collection

You can also export the postman api collection and import in postman.

Run server through Docker

If you want to run the server using docker-compose hit the following command.

$ docker-compose up --build