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': '', } }