Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add ALLOWED_HOSTS setting.

  • Loading branch information...
commit 877578272d5644ab652bf1ee14f3d2bc438a922f 1 parent 436106b
@Osmose Osmose authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 flicks/settings/base.py
View
10 flicks/settings/base.py
@@ -97,6 +97,16 @@
# Secure Cookies
SESSION_COOKIE_SECURE = True
+# Set ALLOWED_HOSTS based on SITE_URL.
+def _allowed_hosts():
+ from django.conf import settings
+ from urlparse import urlparse
+
+ host = urlparse(settings.SITE_URL).netloc # Remove protocol and path
+ host = host.rsplit(':', 1)[0] # Remove port
+ return [host]
+ALLOWED_HOSTS = lazy(_allowed_hosts, list)()
+
# Django-CSP
CSP_IMG_SRC = ("'self'",
'data:',
Please sign in to comment.
Something went wrong with that request. Please try again.