mirror of
https://github.com/jazzband/django-ddp.git
synced 2026-05-20 13:21:55 +00:00
Fixed #7 -- Warn if using DB engines other than psycopg2.
This commit is contained in:
parent
a9df2f27df
commit
73465d6ed4
1 changed files with 8 additions and 8 deletions
16
dddp/apps.py
16
dddp/apps.py
|
|
@ -1,6 +1,5 @@
|
||||||
"""Django DDP app config."""
|
"""Django DDP app config."""
|
||||||
|
import warnings
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.conf import settings, ImproperlyConfigured
|
from django.conf import settings, ImproperlyConfigured
|
||||||
|
|
@ -15,18 +14,19 @@ class DjangoDDPConfig(AppConfig):
|
||||||
api = None
|
api = None
|
||||||
name = 'dddp'
|
name = 'dddp'
|
||||||
verbose_name = 'Django DDP'
|
verbose_name = 'Django DDP'
|
||||||
_in_migration = False
|
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
"""Initialisation for django-ddp (setup lookups and signal handlers)."""
|
"""Initialisation for django-ddp (setup lookups and signal handlers)."""
|
||||||
if not settings.DATABASES:
|
if not settings.DATABASES:
|
||||||
raise ImproperlyConfigured('No databases configured.')
|
raise ImproperlyConfigured('No databases configured.')
|
||||||
for (alias, conf) in settings.DATABASES.items():
|
for (alias, conf) in settings.DATABASES.items():
|
||||||
if conf['ENGINE'] != 'django.db.backends.postgresql_psycopg2':
|
engine = conf['ENGINE']
|
||||||
raise ImproperlyConfigured(
|
if engine != 'django.db.backends.postgresql_psycopg2':
|
||||||
'%r uses %r: django-ddp only works with PostgreSQL.' % (
|
warnings.warn(
|
||||||
alias, conf['backend'],
|
'Database %r uses unsupported %r engine.' % (
|
||||||
)
|
alias, engine,
|
||||||
|
),
|
||||||
|
UserWarning,
|
||||||
)
|
)
|
||||||
self.api = autodiscover()
|
self.api = autodiscover()
|
||||||
self.api.ready()
|
self.api.ready()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue