django-ddp/dddp/apps.py

36 lines
1 KiB
Python
Raw Permalink Normal View History

2015-02-23 04:29:18 +00:00
"""Django DDP app config."""
import warnings
2015-02-23 04:29:18 +00:00
from django.apps import AppConfig
from django.conf import settings, ImproperlyConfigured
2015-02-23 04:29:18 +00:00
from dddp import autodiscover
2015-04-08 06:14:22 +00:00
2015-02-23 04:29:18 +00:00
class DjangoDDPConfig(AppConfig):
"""Django app config for django-ddp."""
api = None
2015-02-23 04:29:18 +00:00
name = 'dddp'
verbose_name = 'Django DDP'
def ready(self):
2015-04-08 06:14:22 +00:00
"""Initialisation for django-ddp (setup lookups and signal handlers)."""
if not settings.DATABASES:
raise ImproperlyConfigured('No databases configured.')
for (alias, conf) in settings.DATABASES.items():
engine = conf['ENGINE']
if engine not in [
'django.db.backends.postgresql',
'django.db.backends.postgresql_psycopg2',
]:
warnings.warn(
'Database %r uses unsupported %r engine.' % (
alias, engine,
),
UserWarning,
)
self.api = autodiscover()
self.api.ready()