import os from settings.common import * # for multi computer room deploy and use separate redis server DEPLOY_ZONE = '' MIDDLEWARE = [ 'service.csrf_service.DisableCSRF', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'service.permission.api_permission.ApiPermissionCheck', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] DEBUG = False ALLOWED_HOSTS = ['*'] MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': os.getenv('DB_NAME', 'loonflow'), # Or path to database file if using sqlite3. 'USER': os.getenv('DB_USER', 'loonflow'), # Not used with sqlite3. 'PASSWORD': os.getenv('DB_PASS', '123456'), # Not used with sqlite3. 'HOST': os.getenv('DB_HOST', '127.0.0.1'), # Set to empty string for localhost. Not used with sqlite3. 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. } } REDIS_HOST = os.getenv('REDIS_HOST', '127.0.0.1') REDIS_PORT = 6379 REDIS_DB = 0 REDIS_PASSWORD = os.getenv('REDIS_PASS', 'loonflow123') if REDIS_PASSWORD: CELERY_BROKER_URL = 'redis://:{}@{}:{}/{}'.format(REDIS_PASSWORD, REDIS_HOST, REDIS_PORT, REDIS_DB) else: CELERY_BROKER_URL = 'redis://{}:{}/{}'.format(REDIS_HOST, REDIS_PORT, REDIS_DB) HOOK_HOST_ALLOWED = [] # host list that allow used as hook url, such as ['192,168.1.12', 'www.baidu.com'], if no this setting key means allow LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_true': { '()': 'django.utils.log.RequireDebugTrue', }, }, 'formatters': { 'standard': { 'format': '%(asctime)s %(pathname)s process-%(process)d thread-%(thread)d %(lineno)d [%(levelname)s]: %(message)s', }, }, 'handlers': { 'file_handler': { 'level': 'INFO', 'class': 'logging.FileHandler', 'filename': HOMEPATH + '/loonflow.log', 'formatter': 'standard' }, 'console': { 'level': 'INFO', 'filters': ['require_debug_true'], 'class': 'logging.StreamHandler', 'formatter': 'standard' }, }, 'loggers': { 'django': { 'handlers': ['console','file_handler'], 'propagate': True, 'level': 'INFO', }, } }