Commit deb24f73 authored by okhin's avatar okhin

Defining ALLOWED_HOSTS to '*' for DEBUG. /spend 10min #19

parent 0adbd12c
Pipeline #1051 failed with stages
in 1 minute and 27 seconds
......@@ -62,7 +62,6 @@ deploy preprod:
- pip install --upgrade -r requirements-dev.txt
- echo "DEBUG = True" > ${BASE_PATH}/project/settings/env.py
- echo "SECRET_KEY = '$(pwgen 20 1)'" >> ${BASE_PATH}/project/settings/env.py
- echo "ALLOWED_HOSTS.append('\'*\'')" >> ${BASE_PATH}/project/settings/env.py
- ${BASE_PATH}/manage.py migrate
- touch ${BASE_PATH}/ready
only:
......
......@@ -34,6 +34,12 @@ os.environ["DJANGO_DEBUG"]
os.environ["DJANGO_SECRET_KEY"]
```
You'll also need to define a DJANGO_ALLOWED_HOSTS containing
the FQDN of the RP before being able to run in production
If DEBUG is defined as True, ALLOWED_HOSTS is set to allow connections
from any hosts.
## Database
You can run migrations with :
......
......@@ -9,3 +9,4 @@ from .auth import * # noqa
from .api import * # noqa
from .static import * # noqa
from .i18n import * # noqa
from .hosts import * # noqa
"""
We need to define ALLOWED_HOSTS in case of debug of if we're
locally running. If we have an env variable DJANGO_ALLOWED_HOSTS
defined, we can use it to.
"""
import os
from .env import DEBUG
if DEBUG:
ALLOWED_HOSTS = ['*']
else:
ALLOWED_HOSTS = [os.environ['DJANGO_ALLOWED_HOSTS']]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment