Skip to content

Email and Django Q Configuration 📧

Email Configuration 📧

Proper email configuration is crucial for the sending email and for the appointment reminder functionality. Add the following to your settings.py:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'your_smtp_host'
EMAIL_PORT = 587 # or 465 for EMAIL_USE_SSL
EMAIL_USE_TLS = True # or EMAIL_USE_SSL = True
EMAIL_HOST_USER = 'your_email@example.com'
EMAIL_HOST_PASSWORD = 'your_email_password'

# Optional: Set your website name for email footer
APPOINTMENT_WEBSITE_NAME = 'Your Website Name'

Note: Make sure to use environment variables or a secure method to store sensitive information like email passwords in production.

Django Q Configuration 📧

Django-Appointment uses Django Q for sending email reminders. This feature is optional but recommended for better performance and user experience.

Setting up Django Q

  1. Install Django Q:

    pip install django_q2
    

  2. Add 'django_q' to INSTALLED_APPS in your settings.py:

    INSTALLED_APPS = [
        # ...
        'django_q',
    ]
    

  3. Configure Django Q in your settings.py:

    Q_CLUSTER = {
        'name': 'django-appointment',
        'workers': 4,
        'timeout': 90,
        'retry': 120,
        'queue_limit': 50,
        'bulk': 10,
        'orm': 'default',
    }
    USE_DJANGO_Q_FOR_EMAILS = True  # Use Django Q for sending ALL emails
    

  4. Start the Django Q cluster:

    python manage.py qcluster
    

Note: If you choose not to use Django Q, email reminders will not be sent, but the rest of the application will function normally.