From 77fa85ae4c03f6ac1dd7e0bcd22cf5effbb6c773 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 21 May 2020 18:34:14 +0200 Subject: [PATCH] Fix, add a possible local_routers.py file for routers database use --- .gitignore | 1 + re2o/settings.py | 2 ++ re2o/settings_local.example.py | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index c978acac..e63fc69f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,5 +44,6 @@ static/logo/ # re2o specific settings_local.py +local_routers.py re2o.png media/ diff --git a/re2o/settings.py b/re2o/settings.py index 3d883615..d119f339 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -154,6 +154,8 @@ USE_TZ = True # Router config for database DATABASE_ROUTERS = ["ldapdb.router.Router"] +if "LOCAL_ROUTERS" in globals(): + DATABASE_ROUTERS += LOCAL_ROUTERS # django-bootstrap3 config BOOTSTRAP3 = { diff --git a/re2o/settings_local.example.py b/re2o/settings_local.example.py index c4ec9ff2..9caea084 100644 --- a/re2o/settings_local.example.py +++ b/re2o/settings_local.example.py @@ -101,6 +101,11 @@ UID_RANGES = {"users": [21001, 30000], "service-users": [20000, 21000]} # A range of GID to use. Used in linux environement GID_RANGES = {"posix": [501, 600]} +# If you want to add a database routers, please fill in above and add your databse. +# Then, add a file "local_routers.py" in folder app re2o, and add your router path in +# the LOCAL_ROUTERS var as "re2o.local_routers.DbRouter". You can also add extra routers. +LOCAL_ROUTERS = [] + # Some optionnal Re2o Apps OPTIONNAL_APPS_RE2O = ()