Amazon clone api using django and django rest framework.
Python 3.6+
$ pip install -r requirements.txtGo 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 migrateTo run the project is very simple just hit this command
$ python manage.py runserverIf 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 testHence 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.pyusing flake8 package
$ flake8 amazon_backend_api/api/views.pyYou 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