Amazon clone api using django and django rest framework.
Python 3.6+
$ pip install -r requirements.txt
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
To run the project is very simple just hit this command
$ python manage.py runserver
If you want api documentations simple visit this
swagger docs
$ http://localhost:8000/api/amz/swagger/
ReDocs docs
$ http://localhost:8000/api/amz/redoc/
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.
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
You can also export the postman api collection and import in postman.
If you want to run the server using docker-compose hit the following command.
$ docker-compose up --build