From de4b7e7ec989b9e32474ca72391e70d519b99d88 Mon Sep 17 00:00:00 2001 From: WinnyTroy Date: Wed, 10 Mar 2021 10:22:28 +0300 Subject: [PATCH 1/3] Clean out unused template file --- .../django/contrib/gis/geos/libgeos.py | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 templates/django_virtualenv_dir/site-packages/django/contrib/gis/geos/libgeos.py diff --git a/templates/django_virtualenv_dir/site-packages/django/contrib/gis/geos/libgeos.py b/templates/django_virtualenv_dir/site-packages/django/contrib/gis/geos/libgeos.py deleted file mode 100644 index 7cfe331..0000000 --- a/templates/django_virtualenv_dir/site-packages/django/contrib/gis/geos/libgeos.py +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py -index 66c61f3a82..b0f9029f89 100644 ---- a/django/contrib/gis/geos/libgeos.py -+++ b/django/contrib/gis/geos/libgeos.py -@@ -141,7 +141,7 @@ def geos_version_info(): - is a release candidate (and what number release candidate), and the C API - version. - """ -- ver = geos_version().decode() -+ ver = geos_version().decode().split(' ')[0] - m = version_regex.match(ver) - if not m: - raise GEOSException('Could not parse version info string "%s"' % ver) From f5249bc9122b0b6b7e58a17102da38ef0834de5a Mon Sep 17 00:00:00 2001 From: WinnyTroy Date: Wed, 10 Mar 2021 10:22:51 +0300 Subject: [PATCH 2/3] Set Mongo vars to None --- defaults/main.yml | 1 + templates/kpi/settings.py.j2 | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 4834427..e7f2af5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -135,3 +135,4 @@ django_environment_vars: web_page_title: "Ona" kpi_raven_frontend_env: "" kpi_raven_backend_env: "" +kpi_enable_mongo_connection: false \ No newline at end of file diff --git a/templates/kpi/settings.py.j2 b/templates/kpi/settings.py.j2 index 24cf73e..98261a3 100644 --- a/templates/kpi/settings.py.j2 +++ b/templates/kpi/settings.py.j2 @@ -765,6 +765,11 @@ if MONGO_DATABASE.get('USER') and MONGO_DATABASE.get('PASSWORD'): else: MONGO_CONNECTION_URL = "mongodb://%(HOST)s:%(PORT)s" % MONGO_DATABASE +{% if kpi_enable_mongo_connection %} MONGO_CONNECTION = MongoClient( MONGO_CONNECTION_URL, j=True, tz_aware=True, connect=False) MONGO_DB = MONGO_CONNECTION[MONGO_DATABASE['NAME']] +{% else %} +MONGO_CONNECTION = None +MONGO_DB = None +{% endif %} From e0b862e6c6d45118930b41ad8e9c18f21747521f Mon Sep 17 00:00:00 2001 From: WinnyTroy Date: Thu, 11 Mar 2021 11:34:43 +0300 Subject: [PATCH 3/3] Fetch Mongo database vars from defaults --- defaults/main.yml | 9 ++++++++- templates/kpi/settings.py.j2 | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index e7f2af5..504b4f4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -135,4 +135,11 @@ django_environment_vars: web_page_title: "Ona" kpi_raven_frontend_env: "" kpi_raven_backend_env: "" -kpi_enable_mongo_connection: false \ No newline at end of file +kpi_enable_mongo_connection: false + +# Mongo vars +kpi_mongo_db_host: "mongo" +kpi_mongo_db_port: 27017 +kpi_mongo_db_name: "formhub" +kpi_mongo_db_user: "" +kpi_mongo_db_password: "" \ No newline at end of file diff --git a/templates/kpi/settings.py.j2 b/templates/kpi/settings.py.j2 index 98261a3..44cf388 100644 --- a/templates/kpi/settings.py.j2 +++ b/templates/kpi/settings.py.j2 @@ -752,11 +752,11 @@ KOBOCAT_DEFAULT_PERMISSION_CONTENT_TYPES = [ ] MONGO_DATABASE = { - 'HOST': os.environ.get('KPI_MONGO_HOST', 'mongo'), - 'PORT': int(os.environ.get('KPI_MONGO_PORT', 27017)), - 'NAME': os.environ.get('KPI_MONGO_NAME', 'formhub'), - 'USER': os.environ.get('KPI_MONGO_USER', ''), - 'PASSWORD': os.environ.get('KPI_MONGO_PASS', '') + 'HOST': '{{ kpi_mongo_db_host }}', + 'PORT': '{{ kpi_mongo_db_port }}', + 'NAME': '{{ kpi_mongo_db_name }}', + 'USER': '{{ kpi_mongo_db_user }}', + 'PASSWORD': '{{ kpi_mongo_db_password }}', } if MONGO_DATABASE.get('USER') and MONGO_DATABASE.get('PASSWORD'):