Would it be possible to return the URL that was used in the returned config?
dj-database-url currently looks for an environment variable and if not present it uses a default URL. I'd like to know the URL that was parsed by dj-database-url.
This allows the routine to both parse for Django DATABASE components, as well as a being a general routine for getting a URL from the environment or falling back to a default if it doesn't exist - MONGOLAB_URI, etc.
The code change seems minor. Something like...
def parse(url):
"""Parses a database URL."""
#--->Initialise config with URL key instead of {}
config = {
'URL': url
}
url = urlparse.urlparse(url)
# Remove query strings.
path = url.path[1:]
path = path.split('?', 2)[0]
# Update with environment configuration.
config.update({
'NAME': path,
'USER': url.username,
'PASSWORD': url.password,
'HOST': url.hostname,
'PORT': url.port,
})
if url.scheme in SCHEMES:
config['ENGINE'] = SCHEMES[url.scheme]
return config
Apologies for not creating a pull request but I'm not completely au fait with github - not a 'real' programmer you see.
Would it be possible to return the URL that was used in the returned config?
dj-database-url currently looks for an environment variable and if not present it uses a default URL. I'd like to know the URL that was parsed by dj-database-url.
This allows the routine to both parse for Django DATABASE components, as well as a being a general routine for getting a URL from the environment or falling back to a default if it doesn't exist - MONGOLAB_URI, etc.
The code change seems minor. Something like...
Apologies for not creating a pull request but I'm not completely au fait with github - not a 'real' programmer you see.
Thanks for your time.