Skip to content

Commit

Permalink
add allow hosts for django app
Browse files Browse the repository at this point in the history
  • Loading branch information
drscream committed Aug 11, 2014
1 parent 05f5f68 commit 4e317c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion copy/tmp/kumquat-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = []

# Application definition

Expand Down
5 changes: 5 additions & 0 deletions copy/var/zoneinit/includes/50-kumquat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ MYSQL_ROOT=$(mdata-get mysql_pw)
MYSQL_KUMQUAT=${MYSQL_KUMQUAT:-$(mdata-get mysql_kumquat_pw 2>/dev/null)} || \
MYSQL_KUMQUAT=$(od -An -N8 -x /dev/random | head -1 | tr -d ' ');
mdata-put mysql_kumquat_pw "${MYSQL_KUMQUAT}"

ALLOWED_HOST=$(hostname)
SECRET_KEY=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-100})

# check if database exists already
Expand Down Expand Up @@ -39,6 +41,9 @@ cat >> /opt/kumquat/kumquat_web/settings.py <<EOF
# Make this unique, and don't share it with anybody.
SECRET_KEY = "${SECRET_KEY}"
# Allow only the hostname and localhost to access
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '${ALLOWED_HOST}']
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
Expand Down

0 comments on commit 4e317c8

Please sign in to comment.