projects
/
styx.blog
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9663015
)
Configure for the server
author
David Kerkeslager
<kerkeslager@gmail.com>
Thu, 13 Aug 2020 01:47:26 +0000
(21:47 -0400)
committer
David Kerkeslager
<kerkeslager@gmail.com>
Thu, 13 Aug 2020 01:47:26 +0000
(21:47 -0400)
styx/settings.py
patch
|
blob
|
history
diff --git
a/styx/settings.py
b/styx/settings.py
index
0f2aca0
..
37af17a
100644
(file)
--- a/
styx/settings.py
+++ b/
styx/settings.py
@@
-11,6
+11,7
@@
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
"""
from pathlib import Path
+import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
@@
-20,13
+21,21
@@
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'mq@_9a6&y4nvgqa7obf-r%a4^dt)z=r8jr&91&=oc^6-=i0*$z'
# SECURITY WARNING: don't run with debug turned on in production!
# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
-
-ALLOWED_HOSTS = []
-
+DEBUG = (os.environ.get('STYX_DEBUG', 'true') == 'true')
+
+if DEBUG:
+ SECRET_KEY = 'mq@_9a6&y4nvgqa7obf-r%a4^dt)z=r8jr&91&=oc^6-=i0*$z'
+else:
+ SECRET_KEY = os.environ['STYX_SECRET_KEY']
+
+ALLOWED_HOSTS = [
+ 'localhost',
+ 'www.localhost',
+ 'styx.blog',
+ '46.101.172.187',
+]
# Application definition
# Application definition
@@
-73,12
+82,22
@@
WSGI_APPLICATION = 'styx.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
+if DEBUG:
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+ }
+else:
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.postgresql_psycopg2',
+ 'NAME': 'styx',
+ 'USER': 'styxuser',
+ 'PASSWORD': os.environ['STYX_DB_PASSWORD'],
+ }
}
}
-}
# Password validation
# Password validation
@@
-118,3
+137,4
@@
USE_TZ = True
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
+STATIC_ROOT = os.path.join(BASE_DIR, 'static/')