|
|
@ -67,21 +67,38 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
|
|
|
|
|
|
|
|
# LOG LEVEL
|
|
|
|
# LOG LEVEL
|
|
|
|
LOG_LEVEL = CONFIG.LOG_LEVEL
|
|
|
|
LOG_LEVEL = CONFIG.LOG_LEVEL
|
|
|
|
|
|
|
|
DOMAINS = CONFIG.DOMAINS or CONFIG.SITE_URL
|
|
|
|
|
|
|
|
ALLOWED_DOMAINS = DOMAINS.split(',') if DOMAINS else ['localhost:8080']
|
|
|
|
|
|
|
|
ALLOWED_DOMAINS = [host.strip() for host in ALLOWED_DOMAINS]
|
|
|
|
|
|
|
|
ALLOWED_DOMAINS = [host.replace('http://', '').replace('https://', '') for host in ALLOWED_DOMAINS if host]
|
|
|
|
|
|
|
|
ALLOWED_DOMAINS = [host.split('/')[0] for host in ALLOWED_DOMAINS if host]
|
|
|
|
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = CONFIG.ALLOWED_HOSTS.split(',') if CONFIG.ALLOWED_HOSTS else ['localhost', '127.0.0.1']
|
|
|
|
DEBUG_HOSTS = ['127.0.0.1', 'localhost']
|
|
|
|
|
|
|
|
DEBUG_PORT = ['8080', '80', '443', '4200', '9528']
|
|
|
|
|
|
|
|
if DEBUG:
|
|
|
|
|
|
|
|
for host in DEBUG_HOSTS:
|
|
|
|
|
|
|
|
for port in DEBUG_PORT:
|
|
|
|
|
|
|
|
ALLOWED_DOMAINS.append('{}:{}'.format(host, port))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = list(set(['.' + host.split(':')[0] for host in ALLOWED_DOMAINS]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("ALLOWED_HOSTS: ", ALLOWED_HOSTS)
|
|
|
|
|
|
|
|
|
|
|
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-CSRF_TRUSTED_ORIGINS
|
|
|
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-CSRF_TRUSTED_ORIGINS
|
|
|
|
CSRF_TRUSTED_ORIGINS = []
|
|
|
|
CSRF_TRUSTED_ORIGINS = []
|
|
|
|
for origin in ALLOWED_HOSTS:
|
|
|
|
|
|
|
|
# 避免错误 先判断一下吧
|
|
|
|
for host in ALLOWED_DOMAINS:
|
|
|
|
if origin.startswith('http'):
|
|
|
|
host = host.strip('.')
|
|
|
|
CSRF_TRUSTED_ORIGINS.append(origin)
|
|
|
|
if host.startswith('http'):
|
|
|
|
|
|
|
|
CSRF_TRUSTED_ORIGINS.append(host)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
if origin.startswith('.'):
|
|
|
|
|
|
|
|
origin = '*.'
|
|
|
|
|
|
|
|
for schema in ['https', 'http']:
|
|
|
|
for schema in ['https', 'http']:
|
|
|
|
CSRF_TRUSTED_ORIGINS.append('{}://{}'.format(schema, origin))
|
|
|
|
# CSRF_TRUSTED_ORIGINS.append('{}://{}'.format(schema, host))
|
|
|
|
|
|
|
|
CSRF_TRUSTED_ORIGINS.append('{}://*.{}'.format(schema, host))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("CSRF_TRUSTED_ORIGINS: ")
|
|
|
|
|
|
|
|
for origin in CSRF_TRUSTED_ORIGINS:
|
|
|
|
|
|
|
|
print(' - ' + origin)
|
|
|
|
# Max post update field num
|
|
|
|
# Max post update field num
|
|
|
|
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000
|
|
|
|
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000
|
|
|
|
|
|
|
|
|
|
|
|