A dockerized Django demo shop
- clone the project
- create a
.envfile in the root of project directory - config
.envvariables based on.env.example
- make sure you have
dockeranddocker-composeinstalled:docker --version docker-compose --version
- run the project using
docker-compose:docker-compose up
- make sure you already have
postgresinstalled, then run the following in a virtual environment:pip install -r requirements.txt python manage.py migrate python manage.py runserver
docker-compose run --rm app sh -c "pytest"or
docker-compose run --rm app sh -c "python manage.py test"pytestor
python manage.py testRun this commands to get coverage report:
docker-compose run --rm app sh -c "coverage run --source='.' manage.py test"
docker-compose run --rm app sh -c "coverage report"coverage run --source='.' manage.py test
coverage reportTo see api documentation:
- redoc:
GET /api/schema/redoc/ - swagger:
GET /api/schema/swagger/
To download the api schema and use it with apps like postman:
- schema download url:
GET /api/schema/
To see all url routes, run:
docker-compose run --rm app sh -c "python manage.py show_urls"To create two users for testing, run:
docker-compose run --rm app sh -c "python manage.py loaddata users"now we have two user with this info:
-
superadmin
{ "password": "pass123456", "username": "superadmin", "email": "[email protected]" } -
admin
{ "password": "pass123456", "username": "admin", "email": "[email protected]" }