Skip to content

Commit

Permalink
trying database settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ederporto committed Sep 14, 2023
1 parent 8486068 commit cb24501
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions sara/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

from pathlib import Path
import configparser
import os
from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -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': '',
}
}

Expand Down

0 comments on commit cb24501

Please sign in to comment.