Use an URL to configure email backend settings in your Django Application.
Project description
This utility is based on dj-database-url by Kenneth Reitz.
It allows to utilize the 12factor inspired environments variable to configure the email backend in a Django application.
Usage
Import the package in settings.py:
import dj_email_url
Fetch your email configuration values. The default option is fetch them from EMAIL_URL environment variable:
email_config = dj_email_url.config()
Other option is parse an arbitrary email URL:
email_config = dj_email_url.parse('smtp://...')
Finally, it is necessary to assign values to settings:
EMAIL_FILE_PATH = email_config['EMAIL_FILE_PATH']
EMAIL_HOST_USER = email_config['EMAIL_HOST_USER']
EMAIL_HOST_PASSWORD = email_config['EMAIL_HOST_PASSWORD']
EMAIL_HOST = email_config['EMAIL_HOST']
EMAIL_PORT = email_config['EMAIL_PORT']
EMAIL_BACKEND = email_config['EMAIL_BACKEND']
EMAIL_USE_TLS = email_config['EMAIL_USE_TLS']
Alternatively, it is possible to use this less explicit shortcut:
vars().update(email_config)
Supported backends
Currently, it supports:
SMTP backend (smtp and smtps),
console backend (console),
file backend (file),
in-memory backend (memory),
and dummy backend (dummy).
The scheme smtps indicates to use TLS connections, that is to set EMAIL_USE_TLS to True.
The file backend is the only one which needs a path. The url path is store in EMAIL_FILE_PATH key.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file dj-email-url-0.0.2.tar.gz
.
File metadata
- Download URL: dj-email-url-0.0.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dc26d22f23fae2c1edcb1417491470aa79909e5818074a240c471d48f0b7cd8 |
|
MD5 | 165d587ad7acadcdc6f8de79f628ec73 |
|
BLAKE2b-256 | 1fbc34b205d24a93331b0af8a9f58c102cf7c6bb5d2f4a52f84c545b4a2db8d8 |