aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/settings.py
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/settings.py')
-rw-r--r--pydis_site/settings.py49
1 files changed, 29 insertions, 20 deletions
diff --git a/pydis_site/settings.py b/pydis_site/settings.py
index d6c7ed96..2050c6ab 100644
--- a/pydis_site/settings.py
+++ b/pydis_site/settings.py
@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
+import secrets
import sys
import environ
@@ -20,11 +21,8 @@ env = environ.Env(
DEBUG=(bool, False)
)
-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-
DEBUG = env('DEBUG')
# Quick-start development settings - unsuitable for production
@@ -39,11 +37,11 @@ if DEBUG:
'staff.pythondiscord.local',
'wiki.pythondiscord.local',
]
- SECRET_KEY = "+_x00w3e94##2-qm-v(5&-x_@*l3t9zlir1etu+7$@4%!it2##"
+ SECRET_KEY = secrets.token_urlsafe(32)
elif 'CI' in os.environ:
ALLOWED_HOSTS = ['*']
- SECRET_KEY = "{©ø¬½.Þ7&Ñ`Q^Kº*~¢j<wxß¾±ðÛJ@q"
+ SECRET_KEY = secrets.token_urlsafe(32)
else:
ALLOWED_HOSTS = env.list(
@@ -53,7 +51,8 @@ else:
'admin.pythondiscord.com',
'api.pythondiscord.com',
'staff.pythondiscord.local',
- 'wiki.pythondiscord.local'
+ 'wiki.pythondiscord.local',
+ 'django.pythondiscord.com',
]
)
SECRET_KEY = env('SECRET_KEY')
@@ -98,6 +97,7 @@ MIDDLEWARE = [
'django_hosts.middleware.HostsRequestMiddleware',
'django.middleware.security.SecurityMiddleware',
+ 'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@@ -135,7 +135,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'pydis_site.wsgi.application'
-
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
@@ -143,7 +142,6 @@ DATABASES = {
'default': env.db()
}
-
# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
@@ -162,30 +160,23 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
-
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
-
LANGUAGE_CODE = 'en-us'
-
TIME_ZONE = 'UTC'
-
USE_I18N = True
-
USE_L10N = True
-
USE_TZ = True
-
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'pydis_site', 'static')]
-STATIC_ROOT = env('STATIC_ROOT', default='staticfiles')
+STATIC_ROOT = env('STATIC_ROOT', default='/app/staticfiles')
MEDIA_URL = '/media/'
-MEDIA_ROOT = env('MEDIA_ROOT', default='media')
+MEDIA_ROOT = env('MEDIA_ROOT', default='/app/media')
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
@@ -207,7 +198,7 @@ if DEBUG:
else:
ALLOWED_HOSTS.append(PARENT_HOST)
else:
- PARENT_HOST = env('PARENT_HOST', default='pythondiscord.com')
+ PARENT_HOST = env('PARENT_HOST', default='django.pythondiscord.com')
# Django REST framework
# http://www.django-rest-framework.org
@@ -221,7 +212,6 @@ REST_FRAMEWORK = {
'TEST_REQUEST_DEFAULT_FORMAT': 'json'
}
-
# Logging
# https://docs.djangoproject.com/en/2.1/topics/logging/
LOGGING = {
@@ -288,7 +278,7 @@ BULMA_SETTINGS = {
}
# Required for the wiki
-LOGIN_URL = "/admin/login" # TODO: Update this when the real login system is in place
+LOGIN_URL = "/admin/login" # Update this when the real login system is in place
SITE_ID = 1
WIKI_ACCOUNT_HANDLING = False
@@ -326,3 +316,22 @@ WIKI_MESSAGE_TAG_CSS_CLASS = {
messages.SUCCESS: "is-success",
messages.WARNING: "is-warning",
}
+
+WIKI_MARKDOWN_HTML_STYLES = [
+ 'max-width',
+ 'min-width',
+ 'margin',
+ 'padding',
+ 'width',
+ 'height',
+]
+
+WIKI_MARKDOWN_HTML_ATTRIBUTES = {
+ 'img': ['class', 'id', 'src', 'alt', 'width', 'height'],
+ 'section': ['class', 'id'],
+ 'article': ['class', 'id'],
+}
+
+WIKI_MARKDOWN_HTML_WHITELIST = [
+ 'article', 'section', 'button'
+]