From 704d34b933d39d1c3b2984b5e8c37ad8bd07a87d Mon Sep 17 00:00:00 2001 From: Sumit Mahar Date: Sun, 25 Jul 2021 12:47:24 +0530 Subject: [PATCH] heroku settings --- Procfile | 1 + config/settings.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..2a05d17 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn config.wsgi --log-file - \ No newline at end of file diff --git a/config/settings.py b/config/settings.py index 2343fa8..660a36a 100644 --- a/config/settings.py +++ b/config/settings.py @@ -11,6 +11,10 @@ """ from pathlib import Path +from environs import Env + +env = Env() +env.read_env() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -20,12 +24,11 @@ # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'm$7zw96+x7hk7wv*qdgbul+#p4r+030svtm3%$vh@l$f0+wh&m72' +SECRET_KEY = env.str("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False - -ALLOWED_HOSTS = ['localhost', 'herokuapp', 'pythonanywhere', '.herokuapp', '.pythonanywhere'] +DEBUG = env.bool("DEBUG", default=False) +ALLOWED_HOSTS = ['localhost', '.herokuapp', '.pythonanywhere', ] # Application definition @@ -81,12 +84,8 @@ # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } -} +DATABASES = {"default": env.dj_db_url("DATABASE_URL")} + # Password validation