Move settings that need to be customized out of default settings file

This commit is contained in:
Kumi 2020-02-15 15:47:31 +01:00
parent bd55d1f03b
commit 431bc2aa88
Signed by: kumi
GPG key ID: 6C2B851B15DF1681
3 changed files with 25 additions and 8 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
__pycache__
*.pyc
migrations/
expcs/custom_settings.py

View file

@ -0,0 +1,14 @@
# Secret Key: Replace this by a long random string.
# You can use django.core.management.utils.get_random_secret_key to generate one.
SECRET_KEY = "changeme"
# Database settings
# This application is tested only with MariaDB/MySQL.
# You will have to edit settings.py if you want to use Postgres, SQLite, etc.
DB_HOST = "localhost"
DB_PORT = 3306
DB_USER = "expcs"
DB_PASS = "secret"
DB_NAME = "expcs"

View file

@ -12,21 +12,18 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
import os
from expcs.custom_settings import *
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'v))#wh%^fu%zq6jy6p50-ywc$s)b0$611honu0j!@*p%_!w1h!'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["*"] # Let the web server handle that. That's its job.
# Application definition
@ -37,6 +34,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'dbsettings',
]
MIDDLEWARE = [
@ -75,8 +73,12 @@ WSGI_APPLICATION = 'expcs.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.mysql',
'NAME': DB_NAME,
'USER': DB_USER,
'PASSWORD': DB_PASS,
'HOST': DB_HOST,
'PORT': str(DB_PORT),
}
}