diff options
-rw-r--r-- | django_skaschool/settings.py | 2 | ||||
-rw-r--r-- | django_skaschool/settings_mysql.py | 2 | ||||
-rw-r--r-- | django_skaschool/settings_production.py | 15 |
3 files changed, 16 insertions, 3 deletions
diff --git a/django_skaschool/settings.py b/django_skaschool/settings.py index 7a20a0f..9b4c779 100644 --- a/django_skaschool/settings.py +++ b/django_skaschool/settings.py @@ -25,6 +25,8 @@ DEBUG = True TEMPLATE_DEBUG = True +# ALLOWED_HOSTS is required when deploying with DEBUG=False, +# otherwise server will throw 400 bad request errors. ALLOWED_HOSTS = [] diff --git a/django_skaschool/settings_mysql.py b/django_skaschool/settings_mysql.py index c941f0f..e22444b 100644 --- a/django_skaschool/settings_mysql.py +++ b/django_skaschool/settings_mysql.py @@ -25,6 +25,8 @@ DEBUG = True TEMPLATE_DEBUG = True +# ALLOWED_HOSTS is required when deploying with DEBUG=False, +# otherwise server will throw 400 bad request errors. ALLOWED_HOSTS = [] diff --git a/django_skaschool/settings_production.py b/django_skaschool/settings_production.py index bcec886..4c1533e 100644 --- a/django_skaschool/settings_production.py +++ b/django_skaschool/settings_production.py @@ -25,7 +25,16 @@ DEBUG = False TEMPLATE_DEBUG = False -ALLOWED_HOSTS = [] +# ALLOWED_HOSTS is required when deploying with DEBUG=False, +# otherwise server will throw 400 bad request errors. +ALLOWED_HOSTS = [ + 'localhost', + '127.0.0.1', + '202.120.52.45', + '202.120.52.18', + '.physics.sjtu.edu.cn', + '.sjtu.edu.cn', +] # Application definition @@ -135,7 +144,7 @@ STATICFILES_DIRS = ( # absolute path to the directory where 'collectstatic' will collect # static files for deployment #STATIC_ROOT = '/var/www/example.com/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static_root') +STATIC_ROOT = os.path.join(BASE_DIR, '../static_root') # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ @@ -144,7 +153,7 @@ STATIC_URL = '/static/' ## media root # absolute filesystem path to the directory that hold user-uploaded files #MEDIA_ROOT = '/var/www/example.com/media/' -MEDIA_ROOT = os.path.join(BASE_DIR, 'media_root') +MEDIA_ROOT = os.path.join(BASE_DIR, '../media_root') # media url MEDIA_URL = '/media/' |