Skip to content
Snippets Groups Projects
Commit 9cec04d0 authored by James Graham's avatar James Graham
Browse files

Add default server to Nginx config and extract ALLOWED_HOSTS from config

parent 62fada80
Branches
Tags
No related merge requests found
server { server {
listen 80; listen 80 default_server;
server_name _; server_name _;
merge_slashes off; merge_slashes off;
......
...@@ -26,6 +26,9 @@ DEBUG ...@@ -26,6 +26,9 @@ DEBUG
Run the server in debug mode? Run the server in debug mode?
Default is 'false'. Default is 'false'.
ALLOWED_HOSTS
List of hostnames on which the server is permitted to run
DATABASE_URL DATABASE_URL
URL to default SQL database - in `dj-database-url <https://github.com/kennethreitz/dj-database-url>`_ format. URL to default SQL database - in `dj-database-url <https://github.com/kennethreitz/dj-database-url>`_ format.
Default is SQLite3 'db.sqlite3' in project root directory. Default is SQLite3 'db.sqlite3' in project root directory.
...@@ -41,7 +44,7 @@ import os ...@@ -41,7 +44,7 @@ import os
from django.urls import reverse_lazy from django.urls import reverse_lazy
from decouple import config from decouple import config, Csv
import dj_database_url import dj_database_url
import mongoengine import mongoengine
...@@ -54,17 +57,9 @@ SECRET_KEY = config('SECRET_KEY') ...@@ -54,17 +57,9 @@ SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False, cast=bool) DEBUG = config('DEBUG', default=False, cast=bool)
if DEBUG: ALLOWED_HOSTS = config('ALLOWED_HOSTS',
ALLOWED_HOSTS = [ cast=Csv(),
'*', default='*' if DEBUG else '127.0.0.1,localhost.localdomain,localhost')
]
else:
ALLOWED_HOSTS = [
'localhost',
'pedasi-dev.eastus.cloudapp.azure.com',
]
# Application definition # Application definition
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment