From f5f3adf7da2a84562d2179b2fa2b72117c57a61c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 10 Jul 2024 13:10:55 +0200 Subject: [PATCH] fixing index.htm as troggle-managed page --- core/views/expo.py | 5 +++++ urls.py | 1 + 2 files changed, 6 insertions(+) diff --git a/core/views/expo.py b/core/views/expo.py index d0f504d..79d37fe 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -138,6 +138,7 @@ def pubspage(request): This is a placeholder, we need to do something like what is done in indexpage() below... """ expowebpath = Path(settings.EXPOWEB) + print("--redirecting from pubspage()") return expowebpage(request, expowebpath, "pubs.htm") def indexpage(request): @@ -146,6 +147,7 @@ def indexpage(request): This edits the most recent year on the fly.. This now works. """ + print("--redirecting from indexpage()") subpath = Path(settings.EXPOWEB) / "index00.htm" with open(subpath, "r") as o: html = o.read() @@ -155,6 +157,9 @@ def indexpage(request): def expowebpage(request, expowebpath, path): """Adds menus and serves an HTML page""" + if path == "" or path == "index.htm": + return indexpage(request) + if not os.path.isfile(expowebpath / path): # Should not get here if the path has suffix "_edit" print(f" - 404 error in expowebpage() {path}") diff --git a/urls.py b/urls.py index 24b0cf2..bd39efb 100644 --- a/urls.py +++ b/urls.py @@ -92,6 +92,7 @@ else: trogglepatterns = [ path('pubs.htm', pubspage, name="pubspage"), # ~165 hrefs to this url in expoweb files + #path('', indexpage, name="indexpage"), # ~1,212 hrefs to this url in expoweb files path('index.htm', indexpage, name="indexpage"), # ~1,212 hrefs to this url in expoweb files path('expofiles/', include(expofilesurls)), # intercepted by Apache, if it is running.