Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update settings #47

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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