Commit 6c68a051 authored by zkuang's avatar zkuang

logging to console

parent 79fd3913
...@@ -12,6 +12,32 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ ...@@ -12,6 +12,32 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
import os import os
import json import json
import logging.config
# LOGGING_CONFIG = None
LOGLEVEL = os.getenv('DJANGO_LOGLEVEL', 'debug').upper()
logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'console': {
'format': '%(asctime)s %(levelname)s [%(name)s:%(lineno)s] %(module)s %(process)d %(thread)d %(message)s',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'console',
},
},
'loggers': {
'': {
'level': LOGLEVEL,
'handlers': ['console',]
},
},
})
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...@@ -24,7 +50,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ...@@ -24,7 +50,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.environ.get('SECRET_KEY') # '1gboig1)_)ljuz_h0&8m%s84ybxz4*z!w0pu$0qi#mobo#poae' SECRET_KEY = os.environ.get('SECRET_KEY') # '1gboig1)_)ljuz_h0&8m%s84ybxz4*z!w0pu$0qi#mobo#poae'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
ALLOWED_HOSTS = json.loads(os.environ.get('ALLOWED_HOSTS')) # ['sso.gzego.com'] ALLOWED_HOSTS = json.loads(os.environ.get('ALLOWED_HOSTS')) # ['sso.gzego.com']
...@@ -131,11 +157,6 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static') ...@@ -131,11 +157,6 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MAMA_CAS_ENABLE_SINGLE_SIGN_OUT = True MAMA_CAS_ENABLE_SINGLE_SIGN_OUT = True
# the service env variable is a json string like this:
# redirect_url logout_url redirect_url logout_url
# ["http://carbinet.gzego.com:8080/api/cas", "http://carbinet.gzego.com:8080/api/cas/logout", ".................", "................."]
#
def make_service_config(redirect_url, logout_url): def make_service_config(redirect_url, logout_url):
return { return {
'SERVICE': redirect_url, 'SERVICE': redirect_url,
...@@ -148,15 +169,3 @@ def make_service_config(redirect_url, logout_url): ...@@ -148,15 +169,3 @@ def make_service_config(redirect_url, logout_url):
service_urls = json.loads(os.environ.get('CAS_SERVICES')) service_urls = json.loads(os.environ.get('CAS_SERVICES'))
MAMA_CAS_SERVICES = [make_service_config(redirect, logout) for redirect, logout in zip(service_urls[0::2], service_urls[1::2])] MAMA_CAS_SERVICES = [make_service_config(redirect, logout) for redirect, logout in zip(service_urls[0::2], service_urls[1::2])]
# MAMA_CAS_SERVICES = [
# {
# 'SERVICE': 'http://carbinet.gzego.com:8080/api/cas',
# 'CALLBACKS': [
# 'mama_cas.callbacks.user_model_attributes',
# ],
# 'LOGOUT_ALLOW': True,
# 'LOGOUT_URL': 'http://carbinet.gzego.com:8080/api/cas/logout',
# },
# ]
\ No newline at end of file
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