django-configurations/configurations/__init__.py
Daniel Hahler 8f199eb40c _setup: do not call django.setup() if settings are configured already
Without this, using `configurations.setup()` after Django has been setup
already re-triggers the logging configuration, which then causes e.g.
pytest's caplog to not work anymore.
2018-08-16 17:04:50 +02:00

31 lines
695 B
Python

# flake8: noqa
from .base import Configuration
from .decorators import pristinemethod
__version__ = '2.1'
__all__ = ['Configuration', 'pristinemethod']
def _setup():
from . import importer
importer.install()
from django.apps import apps
if not apps.ready:
import django
django.setup()
def load_ipython_extension(ipython):
"""
The `ipython` argument is the currently active `InteractiveShell`
instance, which can be used in any way. This allows you to register
new magics or aliases, for example.
"""
_setup()
def setup(app=None):
"""Function used to initialize configurations similar to :func:`.django.setup`."""
_setup()