mirror of
https://github.com/jazzband/dj-database-url.git
synced 2026-03-16 22:20:24 +00:00
defaults for env
This commit is contained in:
parent
9ab34db82a
commit
2a78118ec7
2 changed files with 8 additions and 3 deletions
|
|
@ -10,13 +10,18 @@ urlparse.uses_netloc.append('sqlite')
|
|||
|
||||
DEFAULT_ENV = 'DATABASE_URL'
|
||||
|
||||
def config(env=DEFAULT_ENV):
|
||||
def config(env=DEFAULT_ENV, default=None):
|
||||
"""Returns configured DATABASE dictionary from DATABASE_URL."""
|
||||
|
||||
config = {}
|
||||
|
||||
if env in os.environ:
|
||||
config = parse(os.environ[env])
|
||||
s = os.environ[env]
|
||||
else:
|
||||
s = default
|
||||
|
||||
if s:
|
||||
config = parse()
|
||||
|
||||
return config
|
||||
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -23,7 +23,7 @@ from setuptools import setup
|
|||
|
||||
setup(
|
||||
name='dj-database-url',
|
||||
version='0.1.3',
|
||||
version='0.1.4',
|
||||
url='https://github.com/kennethreitz/dj-database-url',
|
||||
license='BSD',
|
||||
author='Kenneth Reitz',
|
||||
|
|
|
|||
Loading…
Reference in a new issue