diff --git a/drupal2spip_lal/base/routers.py b/drupal2spip_lal/base/routers.py index 6d99423..618817d 100644 --- a/drupal2spip_lal/base/routers.py +++ b/drupal2spip_lal/base/routers.py @@ -2,6 +2,8 @@ class Drupal2SPIPRouter: def db_for_read(self, model, **hints): if model._meta.app_label == 'drupal': return 'drupal' + if model._meta.app_label == 'spip': + return 'spip' return None def db_for_write(self, model, **hints): @@ -12,7 +14,7 @@ class Drupal2SPIPRouter: We disallow cross db relations. """ app1, app2 = obj1._meta.app_label, obj2._meta.app_label - if 'drupal' in [app1, app2]: + if 'drupal' in [app1, app2] or 'spip' in [app1, app2]: return app1 == app2 return None @@ -20,6 +22,6 @@ class Drupal2SPIPRouter: """ We disallow migrations for those db. """ - if db == 'drupal': + if db in ['drupal', 'spip']: return False return None diff --git a/drupal2spip_lal/settings/base.py b/drupal2spip_lal/settings/base.py index 1f42c85..2c833f3 100644 --- a/drupal2spip_lal/settings/base.py +++ b/drupal2spip_lal/settings/base.py @@ -60,6 +60,10 @@ DATABASES = { 'DRUPAL_DATABASE_URL', default='sqlite:///{}'.format(base_dir('drupal.db')), ), + 'spip': env.db_url( + 'SPIP_DATABASE_URL', + default='sqlite:///{}'.format(base_dir('spip.db')), + ), } DATABASE_ROUTERS = ['drupal2spip_lal.base.routers.Drupal2SPIPRouter']