Skip to content

Docker Support 🐳

The repository comes with a Docker setup to try the app or work on it locally.

Note: This setup is meant for development and local testing, and it runs from a clone of the repository. For production, follow Django's deployment checklist.

  1. Clone the repository and go into it:
git clone https://github.com/adamspd/django-appointment.git
# or, with SSH: git clone git@github.com:adamspd/django-appointment.git
cd django-appointment
  1. Create a .env file at the root of the repository. Fill in your own email server's details if you want emails to work:
# Main admin user. To add more admins, change ADMINS in appointments/settings.py
ADMIN_NAME="Super Admin"
ADMIN_EMAIL=super.admin@example.com

# Replace these 3 with your own, otherwise sending emails will fail
EMAIL_HOST_USER=no-reply@example.com
EMAIL_HOST_PASSWORD=youcantguessme
EMAIL_HOST=smtp.example.com

# The default backend, you can leave it as is
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend

# 587 for TLS. For SSL, use 465 and EMAIL_USE_SSL=True instead
EMAIL_PORT=587
EMAIL_USE_TLS=True

# Django Q is already installed in the Docker image. Outside Docker, install django-q2 first
USE_DJANGO_Q=True

Note: The .env file holds secrets. Don't commit it.

  1. Build and start the containers:
docker compose up -d --build

On older Docker installs, use docker-compose (with a hyphen) instead of docker compose in every command.

  1. Create and apply the migrations:
docker compose exec web python manage.py makemigrations appointment
docker compose exec web python manage.py migrate
  1. Create a superuser to log in to the Django admin:
docker compose exec web python manage.py createsuperuser
  1. Open the app at http://localhost:8000 and the Django admin at http://localhost:8000/admin/. From there, add a service and a staff member by following the tutorial.

  2. Stop the containers when you're done:

docker compose down

Note: The Docker setup uses the project's default database (SQLite). To use another database, change the Dockerfile and docker-compose.yml.