perf: 修改写法

pull/11062/head
ibuler 2023-07-24 17:55:17 +08:00
parent 38e8e8734d
commit 148bf3b894
1 changed files with 2 additions and 4 deletions

View File

@ -76,12 +76,10 @@ ALLOWED_DOMAINS = [host.split('/')[0] for host in ALLOWED_DOMAINS if host]
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))
DEBUG_HOST_PORTS = ['{}:{}'.format(host, port) for host in DEBUG_HOSTS for port in DEBUG_PORT]
ALLOWED_DOMAINS.extend(DEBUG_HOST_PORTS)
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