Update settings.py

This commit is contained in:
Eugene Pankov 2021-07-26 21:28:13 +02:00
parent f818dbf03e
commit be5d360a9e
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -2,6 +2,7 @@ import os
import dj_database_url import dj_database_url
from dotenv import load_dotenv from dotenv import load_dotenv
from pathlib import Path from pathlib import Path
from urllib.parse import urlparse
load_dotenv() load_dotenv()
@ -238,7 +239,7 @@ if FRONTEND_URL:
'x-xsrf-token', 'x-xsrf-token',
'x-requested-with', 'x-requested-with',
] ]
CSRF_TRUSTED_ORIGINS = [FRONTEND_URL] CSRF_TRUSTED_ORIGINS = [urlparse(FRONTEND_URL).hostname]
FRONTEND_URL = FRONTEND_URL.rstrip('/') FRONTEND_URL = FRONTEND_URL.rstrip('/')
else: else:
FRONTEND_URL = '' FRONTEND_URL = ''