Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 87717e6f authored by Jon Yu's avatar Jon Yu
Browse files

Add some logging config, email settings

parent e1197fc5
ADMINS=admin=jonathoy@umich.edu
ALLOWED_HOSTS=127.0.0.1,localhost
DEBUG=1
SECRET_KEY=123
\ No newline at end of file
DEBUG=0
# OpenShift
# EMAIL_HOST=vdc-relay.us-east-2.a.mail.umich.edu
# Unauthenticated mail relay for UM
EMAIL_HOST=mail-relay.itd.umich.edu
EMAIL_SUBJECT_PREFIX=localhost
LOGGING_LEVEL=INFO
SECRET_KEY=123
SERVER_EMAIL=django@localhost
\ No newline at end of file
......@@ -27,18 +27,38 @@ DEBUG = os.getenv('DEBUG') in ['true', 'True', '1', 'yes'] if os.getenv('DEBUG')
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '127.0.0.1').split(',')
# https://docs.djangoproject.com/en/2.2/ref/settings/#admins
# e.g. ADMINS=admin=admin@umich.edu,user=user@umich.edu
# => [('admin', 'admin@umich.edu'), ('user', 'user@umich.edu')]
ADMINS = [tuple(a.split('=')) for a in os.getenv('ADMINS').split(',')] if os.getenv('ADMINS') else []
# Email
# https://docs.djangoproject.com/en/3.0/topics/email/
if os.getenv('SERVER_EMAIL'):
SERVER_EMAIL = os.getenv('SERVER_EMAIL')
EMAIL_HOST = os.getenv('EMAIL_HOST', None)
EMAIL_SUBJECT_PREFIX = f'[{os.getenv("EMAIL_SUBJECT_PREFIX", "localhost")}] '
# Application definition
# Add additional non-Django apps here for consistent logging behavior
EXTRA_APPS = [
'um_template_ui'
]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'um_template_ui'
]
'django.contrib.staticfiles'
] + EXTRA_APPS
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
......@@ -116,6 +136,59 @@ USE_L10N = True
USE_TZ = True
# Logging
# https://docs.djangoproject.com/en/2.2/topics/logging/
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
'style': '{'
},
'simple': {
'format': '{levelname} {message}',
'style': '{'
}
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'formatter': 'simple',
'filters': ['require_debug_false']
}
},
'loggers': {
**{
'django': {
'level': os.getenv('LOGGING_LEVEL', 'INFO'),
'handlers': ['console', 'mail_admins'],
'propagate': True
},
},
**{
app: {
'level': os.getenv('LOGGING_LEVEL', 'INFO'),
'handlers': ['console', 'mail_admins'],
'propagate': False
} for app in EXTRA_APPS
}
}
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment