diff --git a/configurations/autosetup.py b/configurations/autosetup.py new file mode 100644 index 0000000..fbac409 --- /dev/null +++ b/configurations/autosetup.py @@ -0,0 +1,4 @@ +"""A module to automatically import and call :func:`setup()`.""" +from . import setup + +setup() diff --git a/docs/cookbook.rst b/docs/cookbook.rst index 8fd2173..0d860ba 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -125,8 +125,7 @@ probably just add the following to the **beginning** of your settings module: .. code-block:: python - import configurations - configurations.setup() + from configurations import autosetup That has the same effect as using the ``manage.py`` or ``wsgi.py`` utilities. This will also call ``django.setup()`` on Django >= 1.7. @@ -155,8 +154,7 @@ Celery's documentation`_: os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'MySiteConfiguration') - import configurations - configurations.setup() + from configurations import autosetup app = Celery('mysite') app.config_from_object('django.conf:settings') @@ -267,4 +265,4 @@ the environment variable accordingly: 'configurations', ] - # ... \ No newline at end of file + # ...