2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 12:17:08 +00:00

Attempt at append_slash, and backtrack.

This commit is contained in:
2025-02-18 19:59:12 +02:00
parent 95190324fb
commit cc06e2e1f4
8 changed files with 73 additions and 53 deletions

View File

@@ -48,6 +48,7 @@ ALLOWED_HOSTS = ["*", "expo.survex.com", ".survex.com", "localhost", "127.0.0.1"
ADMINS = (
('Wookey', 'wookey@wookware.org'),
('Philip', 'philip.sargent@klebos.eu'),
)
MANAGERS = ADMINS
@@ -78,15 +79,12 @@ FIX_PERMISSIONS = []
# SURVEX_TOPNAME = "1623-and-1626-no-schoenberg-hs"
SURVEX_TOPNAME = "troggle_import_root" # same, but without all the 'essentials' gubbins
APPEND_SLASH = (
False # never relevant because we have urls that match unknown files and produce an 'edit this page' response
)
SMART_APPEND_SLASH = True # not eorking as middleware different after Dj2.0
ROOT_URLCONF = "troggle.urls"
ROOT_URLCONF = "troggle.urls" # i.e. troggle/urls.py
LOGOUT_REDIRECT_URL = "/statistics" # see troggle/core/views/auth.py
LOGIN_REDIRECT_URL = "/controlpanel" # see troggle/core/views/auth.py
PASSWORD_RESET_TIMEOUT = 3*60*60 # password reset sends an email. The response is valid for 3 hours
#ACCOUNT_ACTIVATION_DAYS = 3 # this is only if we are using django-registration package
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
@@ -114,6 +112,8 @@ FORM_RENDERER = "django.forms.renderers.TemplatesSetting" # Required to customi
# Note that this is a radically different onion architecture from earlier versions though it looks the same,
# see https://docs.djangoproject.com/en/dev/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
# Seriously, read this: https://www.webforefront.com/django/middlewaredjango.html which is MUCH BETTER than the docs
# We are NOT using the home-built SmartAppendSlashMiddleware
MIDDLEWARE = [
#'django.middleware.security.SecurityMiddleware', # SECURE_SSL_REDIRECT and SECURE_SSL_HOST # we don't use this
"django.middleware.gzip.GZipMiddleware", # not needed when expofiles and photos served by apache
@@ -125,15 +125,14 @@ MIDDLEWARE = [
"django.contrib.messages.middleware.MessageMiddleware", # Cookie-based and session-based message support. Needed by admin system
"django.middleware.clickjacking.XFrameOptionsMiddleware", # clickjacking protection via the X-Frame-Options header
#'django.middleware.security.SecurityMiddleware', # SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, SECURE_REFERRER_POLICY, and SECURE_SSL_REDIRECT
#'troggle.core.middleware.SmartAppendSlashMiddleware' # needs adapting after Dj2.0
#"troggle.core.middleware.TroggleAppendSlashMiddleware", # modified Feb.2025
]
WSGI_APPLICATION = "troggle.wsgi.application" # change to asgi as soon as we upgrade to Django 3.0
ACCOUNT_ACTIVATION_DAYS = 3
# AUTH_PROFILE_MODULE = 'core.person' # used by removed profiles app ?
# Append slash can't work if we have a universal catchall URL rule, and we do because all the handbook files
# do not have simple prefix. This is why we used to have an /expoweb/ prefix for everything in the website.
# APPEND_SLASH = True # using django.middleware.common.CommonMiddleware. Pointless, never happens if there is a catchall.
# TROGGLE_APPEND_SLASH = True # this is our middleware: see the code in troggle/core/middleware.py for why we do NOT use it.
QM_PATTERN = r"\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]"
# Re-enable TinyMCE when Dj upgraded to v3. Also templates/editexpopage.html
@@ -148,5 +147,4 @@ TEST_RUNNER = "django.test.runner.DiscoverRunner"
print("+ finished importing troggle/settings.py, re-importing localsettings again")
from localsettings import *
# localsettings needs to take precedence. Call it to override any existing vars.