Install Docker & docker-compose, then:
cp sample.env .env
docker-compose up --build
After first build, you can just run:
docker-compose up
To run unit tests:
docker-compose run --rm app sh -c "python manage.py test"
Create a new database migration file:
docker-compose run --rm app sh -c "python manage.py makemigrations"
Optionally, dry-run migration creation to see if models formatted correctly:
docker-compose run --rm app sh -c "python manage.py makemigrations --dry-run"
Apply the migration to the database:
docker-compose run --rm app sh -c "python manage.py migrate"
You can log into the admin dashboard by going to the route /admin
and using the following credentials:
- Username:
[email protected]
- Password:
changeme
These defaults are set via environment variables:
DJANGO_SUPERUSER_EMAIL="[email protected]"
DJANGO_SUPERUSER_PASS="changeme"
If you want to change these values, copy the sample.env file to a new .env
file and change the values. If you already created an admin with the other credentials, then another one won't be created automatically. To get another one to be created automatically, remove the database and restart the app with this command:
docker-compose down --remove-orphans -v
docker-compose up
If you want to create a new admin without removing the old database, run this command:
docker-compose run --rm app sh -c "python manage.py createsuperuser --no-input"
If the docker-compose commands get too tedious, we may want to consider these task managers: