Skip to content

Commit

Permalink
Update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
dglemos committed Oct 11, 2024
1 parent 8a138cc commit 73721e2
Showing 1 changed file with 38 additions and 17 deletions.
55 changes: 38 additions & 17 deletions gene2phenotype_project/gene2phenotype_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@

# Application definition

### The following variable prints all the db queries to the command line
### This is useful to debug sql queries
# LOGGING = {
# 'version': 1,
# 'disable_existing_loggers': False,
# 'handlers': {
# 'console': {
# 'level': 'DEBUG',
# 'class': 'logging.StreamHandler',
# },
# },
# 'loggers': {
# 'django.db.backends': {
# 'level': 'DEBUG',
# 'handlers': ['console'],
# },
# },
# }

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
Expand Down Expand Up @@ -101,29 +120,31 @@
# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

config_path = os.environ.get('PROJECT_CONFIG_PATH')
config = ConfigParser()
config.read(config_path)


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': config.get('database', 'name'),
'USER': config.get('database', 'user'),
'PASSWORD': config.get('database', 'password'),
'HOST': config.get('database', 'host'),
'PORT': config.get('database', 'port'),
}
}

# For testing
if 'test' in sys.argv or 'test_coverage' in sys.argv:
DATABASES['default'] = {
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}

else:
config_path = os.environ.get('PROJECT_CONFIG_PATH')
config = ConfigParser()
config.read(config_path)

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': config.get('database', 'name'),
'USER': config.get('database', 'user'),
'PASSWORD': config.get('database', 'password'),
'HOST': config.get('database', 'host'),
'PORT': config.get('database', 'port'),
}
}

# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

Expand Down

0 comments on commit 73721e2

Please sign in to comment.