From 296762fb7fd4144a54b3503f0af936d3a46fcea6 Mon Sep 17 00:00:00 2001 From: artofnuel Date: Mon, 15 Aug 2022 15:37:41 +0100 Subject: [PATCH] Major Changes --- Procfile | 1 + movie/prod_settings.py | 14 ++++++++++++++ movie/settings.py | 9 +++------ 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 movie/prod_settings.py diff --git a/Procfile b/Procfile index c3e31ef..2129506 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,2 @@ +release: python manage.py migrate --no-input web: gunicorn movie.wsgi \ No newline at end of file diff --git a/movie/prod_settings.py b/movie/prod_settings.py new file mode 100644 index 0000000..5487348 --- /dev/null +++ b/movie/prod_settings.py @@ -0,0 +1,14 @@ +""" Production Settings """ +# default: use settings from main settings.py if not overwritten +from .settings import * + +import django_heroku + + +DEBUG = False +SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', SECRET_KEY) +# adjust to the URL of your Heroku app +ALLOWED_HOSTS = ['django-hello-world-app.herokuapp.com'] + +# Activate Django-Heroku. +django_heroku.settings(locals()) \ No newline at end of file diff --git a/movie/settings.py b/movie/settings.py index 56f6be1..8785ffa 100644 --- a/movie/settings.py +++ b/movie/settings.py @@ -9,8 +9,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ -import django_heroku -from django.conf import settings + from pathlib import Path import os @@ -46,6 +45,7 @@ ] MIDDLEWARE = [ + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -132,7 +132,7 @@ MEDIA_URL='/media/' MEDIA_ROOT=BASE_DIR/'media' -STATIC_ROOT = os.path.join(BASE_DIR/'static_root') +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS=[ BASE_DIR/'static' @@ -153,6 +153,3 @@ LOGIN_REDIRECT_URL = "movies:all_movies" - -# Activate Django-Heroku -django_heroku_settings(locals()) \ No newline at end of file