diff --git a/AUTHORS b/AUTHORS index 108baa8..9661ac9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,4 +3,5 @@ Gilles Fabio Jannis Leidel Marc Abramowitz Michael van Tellingen -Mike Fogel \ No newline at end of file +Mike Fogel +Peter Bittner diff --git a/README.rst b/README.rst index c80f72c..faf46ed 100644 --- a/README.rst +++ b/README.rst @@ -32,6 +32,12 @@ Install django-configurations: pip install django-configurations +or, alternatively, if you want to use URL-based values: + +.. code-block:: console + + pip install django-configurations[cache,database,email,search] + Then subclass the included ``configurations.Configuration`` class in your project's **settings.py** or any other module you're using to store the settings constants, e.g.: diff --git a/configurations/importer.py b/configurations/importer.py index f9dfd6c..e43f2b8 100644 --- a/configurations/importer.py +++ b/configurations/importer.py @@ -124,8 +124,8 @@ class ConfigurationImporter(object): def stylize(text): return colorize(text, fg='green') - if (self.argv[1] == 'runserver' and - os.environ.get('RUN_MAIN') == 'true'): + if self.argv[1] == 'runserver' \ + and os.environ.get('RUN_MAIN') == 'true': message = ("django-configurations version {0}, using " "configuration '{1}'".format(__version__, diff --git a/configurations/values.py b/configurations/values.py index 056e9a0..af53b62 100644 --- a/configurations/values.py +++ b/configurations/values.py @@ -52,8 +52,8 @@ class Value(object): instance.late_binding = kwargs.get('late_binding') if not instance.late_binding: instance.__init__(*args, **kwargs) - if ((instance.environ and instance.environ_name) or - (not instance.environ and instance.default)): + if (instance.environ and instance.environ_name) \ + or (not instance.environ and instance.default): instance = instance.setup(instance.environ_name) return instance diff --git a/setup.py b/setup.py index 06fd946..7a2efdf 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,22 @@ setup( 'django-cadmin = configurations.management:execute_from_command_line', ], }, + extras_require={ + 'cache': ['django-cache-url'], + 'database': ['dj-database-url'], + 'email': ['dj-email-url'], + 'search': ['dj-search-url'], + 'testing': [ + 'django-discover-runner', + 'mock', + 'django-cache-url>=1.0.0', + 'dj-database-url', + 'dj-email-url', + 'dj-search-url', + 'six', + 'Sphinx>=1.4', + ], + }, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Framework :: Django', @@ -49,10 +65,9 @@ setup( 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Utilities', ], zip_safe=False, diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index f62636b..0000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -django-discover-runner -mock -dj-database-url -dj-email-url -dj-search-url -django-cache-url>=1.0.0 -six -Sphinx>=1.4 diff --git a/tox.ini b/tox.ini index cca6f96..5f3454b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] -skipsdist = True -usedevelop = True +skipsdist = true +usedevelop = true minversion = 1.8 -whitelist_externals=sphinx-build +whitelist_externals = sphinx-build envlist = flake8-py27, flake8-py36, @@ -19,7 +19,6 @@ setenv = coverage: COVERAGE_PROCESS_START = {toxinidir}/setup.cfg coverage: _TEST_RUN_PREFIX=coverage run deps = - -rtests/requirements.txt dj18: django>=1.8,<1.9 dj110: django>=1.10,<1.11 dj111: django>=1.11,<2.0 @@ -29,7 +28,7 @@ deps = py27,pypy: mock coverage: coverage coverage: coverage_enable_subprocess - +extras = testing commands = python --version {env:_TEST_RUN_PREFIX:} {envbindir}/django-cadmin test -v2 {posargs:tests} @@ -49,5 +48,5 @@ commands = flake8 configurations tests deps = flake8 [flake8] -exclude=.tox -ignore=E501,E127,E128,E124 +exclude = .tox +ignore = E501,E127,E128,E124