Move settings into module and split out dev settings

This commit is contained in:
Adam Goldsmith 2020-12-18 14:09:11 -05:00
parent fb0b5be914
commit 34d659050e
6 changed files with 27 additions and 27 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
__pycache__
/recmaint/settings/prod.py

View File

@ -6,7 +6,7 @@ import sys
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'recmaint.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'recmaint.settings.dev')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:

View File

View File

@ -14,17 +14,7 @@ import os
from pathlib import Path from pathlib import Path
# 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.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'g&zqf68eks@z$ctb%3_5+retmt%_i0=)7-y$i^gvc6p#s1+*ng'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = []
@ -73,17 +63,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'recmaint.wsgi.application' WSGI_APPLICATION = 'recmaint.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation # Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
@ -109,13 +88,9 @@ LOGIN_REDIRECT_URL = '/'
# https://docs.djangoproject.com/en/3.1/topics/i18n/ # https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/New_York' TIME_ZONE = 'America/New_York'
USE_I18N = False USE_I18N = False
USE_L10N = True USE_L10N = True
USE_TZ = True USE_TZ = True

20
recmaint/settings/dev.py Normal file
View File

@ -0,0 +1,20 @@
from .base import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'g&zqf68eks@z$ctb%3_5+retmt%_i0=)7-y$i^gvc6p#s1+*ng'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}

View File

@ -0,0 +1,3 @@
from .base import *
DEBUG = False