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.
- 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
- Create a
.envfile 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
.envfile holds secrets. Don't commit it.
- Build and start the containers:
On older Docker installs, use
docker-compose(with a hyphen) instead ofdocker composein every command.
- Create and apply the migrations:
docker compose exec web python manage.py makemigrations appointment
docker compose exec web python manage.py migrate
- Create a superuser to log in to the Django admin:
-
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.
-
Stop the containers when you're done:
Note: The Docker setup uses the project's default database (SQLite). To use another database, change the
Dockerfileanddocker-compose.yml.