A dockerized Django demo shop
- clone the project
- create a
.env
file in the root of project directory - config
.env
variables based on.env.example
- make sure you have
docker
anddocker-compose
installed:docker --version docker-compose --version
- run the project using
docker-compose
:docker-compose up
- make sure you already have
postgres
installed, 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"
pytest
or
python manage.py test
Run 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 report
To 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]" }