From cb2450102f0842e2c860d36053fd0d026801415b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Porto?= Date: Thu, 14 Sep 2023 01:37:46 -0300 Subject: [PATCH] trying database settings --- sara/settings.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sara/settings.py b/sara/settings.py index 012efb5..2841115 100644 --- a/sara/settings.py +++ b/sara/settings.py @@ -11,6 +11,7 @@ """ from pathlib import Path +import configparser import os from django.utils.translation import gettext_lazy as _ @@ -81,10 +82,23 @@ # Database # https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +HOME = os.environ.get('HOME') +replica_path = HOME + '/replica.my.cnf' +if os.path.exists(replica_path): + config = configparser.ConfigParser() + config.read(replica_path) +else: + print('replica.my.cnf file not found') + DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 's55346__saradb', + 'USER': config['client']['user'], + 'PASSWORD': config['client']['password'], + 'HOST': 'tools.db.svc.wikimedia.cloud', + 'PORT': '', } }