perf: 添加 DEBUG 日志

pull/11062/head
ibuler 1 year ago
parent d8d487f770
commit 38e8e8734d

@ -514,10 +514,9 @@ class Config(dict):
'TIME_ZONE': 'Asia/Shanghai', 'TIME_ZONE': 'Asia/Shanghai',
'FORCE_SCRIPT_NAME': '', 'FORCE_SCRIPT_NAME': '',
'SESSION_COOKIE_SECURE': False, 'SESSION_COOKIE_SECURE': False,
'ALLOWED_HOSTS': '', 'TRUST_SITES': '',
'CSRF_COOKIE_SECURE': False, 'CSRF_COOKIE_SECURE': False,
'REFERER_CHECK_ENABLED': False, 'REFERER_CHECK_ENABLED': False,
'CSRF_TRUSTED_ORIGINS': '',
'SESSION_ENGINE': 'cache', 'SESSION_ENGINE': 'cache',
'SESSION_SAVE_EVERY_REQUEST': True, 'SESSION_SAVE_EVERY_REQUEST': True,
'SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE': False, 'SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE': False,

@ -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

@ -7,16 +7,14 @@ azure-mgmt-network==23.1.0
google-cloud-compute==1.13.0 google-cloud-compute==1.13.0
grpcio==1.56.2 grpcio==1.56.2
alibabacloud_dysmsapi20170525==2.0.24 alibabacloud_dysmsapi20170525==2.0.24
python-novaclient==11.0.1 python-novaclient==18.3.0
python-keystoneclient==5.1.0 python-keystoneclient==5.1.0
bce-python-sdk==0.8.87 bce-python-sdk==0.8.87
tencentcloud-sdk-python==3.0.941 tencentcloud-sdk-python==3.0.941
aliyun-python-sdk-core-v3==2.13.33 aliyun-python-sdk-core-v3==2.13.33
aliyun-python-sdk-ecs==4.24.64 aliyun-python-sdk-ecs==4.24.64
huaweicloud-sdk-python==1.0.28 #huaweicloud-sdk-python==1.0.28
# python-keystoneclient need keystoneauth1>=3.4.0 keystoneauth1==5.2.1
# huaweicloud-sdk-python need keystoneauth1<=3.4.0
keystoneauth1==3.4.0
# DB requirements # DB requirements
oracledb==1.3.2 oracledb==1.3.2
psycopg2-binary==2.9.6 psycopg2-binary==2.9.6

Loading…
Cancel
Save