Sunday, December 23, 2018

[ANN] django-service-urls 1.0.1

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')

--

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABgH4JuDanE0KegwNBmZ1qq1QmeQHn1-%3DLGqNtu2mHXz%3DLW7uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment