django / django/new-features

Add service URI parsing support

Open
#165 3 comments 7 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
188
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [x] I agree to follow Django's Code of Conduct

### Package Information

* dj-database-url
* django-service-urls

### Problem

With the JazzBand sailing off into the sunset and `dj-database-url` being one of the most downloaded Django packages on PyPi, I'd love to make a push to add a URL settings parser to Django.

### Rationale

URI-based credentials have become the norm for most datastores. From RDBs to KV stores, their CLIs usually support URIs natively. Yet Django doesn't, even though the 12-factor-fanclub and the Django community are heavily overlapping.

I believe most people don't spend a second thought before installing `dj-database-url` by default. However, with the JazzBand end, I think this package has earned its spot in Django's utils and future DSF support.

### Scope limitation

This proposal does NOT aim to include environment parsing. The proposal is limited to parsing URIs into service setting objects. Nothing more. URI may be provided however a user chooses to. 3rd-parties may expand on the parser and use it to provide narrower integrations.

### Additional Details

[#8562](https://github.com/django/django/pull/8562)
[ticket-28236](https://code.djangoproject.com/ticket/28236)

### Implementation Details

I am not saying to include the whole package, but the dictionary parser.

Especially with the email setting becoming a dictionary too. We can provide a neat experience for external services.

Something like
```python
from django.conf.utils import parse_service_uri

DATABASE = {
"default": parse_service_uri(os.getenv("DATABASE_URL")),
}

CACHES = {
"default": parse_service_uri(os.getenv("REDIS_URL"), options={
"pool_class": "redis.BlockingConnectionPool"
}),
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.