Prepare for deploy

This commit is contained in:
Nikola Kubiczek 2021-09-03 00:40:52 +02:00
parent 3ccf65b8e5
commit 9afa7f928f
3 changed files with 23 additions and 8 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
db.sqlite3 db.sqlite3
media/ media/
.env

View File

@ -11,6 +11,10 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
""" """
from pathlib import Path from pathlib import Path
from dotenv import load_dotenv
import os
load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -20,12 +24,17 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-d&9*2#r2_)aaskh23)tpu!#jyu*e2yyw0ajg-2@25444^5$eov'
# SECURITY WARNING: don't run with debug turned on in production! SECRET_KEY = os.getenv('SECRET_KEY')
DEBUG = True EMAIL_BACKEND = os.getenv('EMAIL_BACKEND')
EMAIL_HOST = os.getenv('EMAIL_HOST')
ALLOWED_HOSTS = ['*', 'puchar.lo5.bielsko.pl', 'localhost', '127.0.0.1'] EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_PORT = int(os.getenv('EMAIL_PORT'))
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
DEBUG = int(os.getenv('DEBUG')) == 1
ALLOWED_HOSTS = ['*']
# Application definition # Application definition
@ -80,8 +89,11 @@ X_FRAME_OPTIONS = 'SAMEORIGIN'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': os.getenv('DB_ENGINE'),
'NAME': BASE_DIR / 'db.sqlite3' 'NAME': os.getenv('DB_NAME'),
'HOST': os.getenv('DB_HOST'),
'USER': os.getenv('DB_USER'),
'PASSWORD': os.getenv('DB_PASSWORD'),
} }
} }

View File

@ -3,3 +3,5 @@ django-cleanup
django-crispy-forms==1.12.0 django-crispy-forms==1.12.0
django-summernote django-summernote
django-crispy-bulma django-crispy-bulma
python-dotenv