jazzband / dj-database-url

Use Database URLs in your Django Application.
https://pypi.org/project/dj-database-url/
BSD 3-Clause "New" or "Revised" License
1.48k stars 205 forks source link

Allow colons (%3A) in percent-encoded paths #66

Closed jdp closed 1 year ago

jdp commented 8 years ago

Postgres supports percent-encoded paths to allow for connecting to the DB over a domain socket since this change, and it would be super helpful to allow percent-encoded colons as well. That way, dj-database-url could be used with Google Cloud SQL, because its socket names are in the format /cloudsql/{project-id}:{sql-instance-id}. Without percent-encoding the colon, it gets interpreted as an invalid port. Adding it would support connection strings like this, like Postgres:

>>> dj_database_url.parse('mysql://root@%2fcloudsql%2fproject-id%3asql-id/database')
{'ENGINE': 'django.db.backends.mysql', 'HOST': '/cloudsql/project-id:sql-id', 'NAME': 'database', 'CONN_MAX_AGE': 0, 'PASSWORD': '', 'PORT': '', 'USER': 'root'}

I have an existing patch if that would be helpful.

kennethreitz commented 8 years ago

A patch would be great.

palfrey commented 1 year ago

Implemented by https://github.com/jazzband/dj-database-url/pull/181 which is now merged