[ANN] django-service-urls 1.0.1

19 views
Skip to first unread message

Raffaele Salmaso

unread,
Dec 23, 2018, 4:45:03 PM12/23/18
to django...@googlegroups.com
I'm happy to announce the release of django-service-urls package, an evolution of dj-database-url which can handle CACHES and EMAIL_BACKEND setting other than DATABASES.

Urls
(I accept patches from every repository)

Install
$ python3 -m pip install django-service-urls

In your settings.py file add at the end one handler for each setting you use
import service_urls
DATABASES = service_urls.db.parse(DATABASES)
CACHES = service_urls.cache.parse(CACHES)
if service_urls.email.validate(EMAIL_BACKEND):
    for k, v in service_urls.email.parse(EMAIL_BACKEND).items():
        setting = 'EMAIL_' + ('BACKEND' if k == 'ENGINE' else k)
        globals()[setting] = v

Usage
Configure your setting (see docs for better example).

DATABASES = {
    'default': os.environ.get('DATABASE_DEFAULT', 'postgres://myuser:mypasswd@localhost:5432/mydb'),
}
CACHES = {
    'default': os.environ.get('CACHE_DEFAULT', ''memcached://127.0.0.1:11211'),
}
EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND', 'smtp://localhost:25')

--
Reply all
Reply to author
Forward
0 new messages