new method for /site-media/, /static/, /photos/

This commit is contained in:
Philip Sargent
2021-03-31 23:19:48 +01:00
parent 9d8a44696b
commit 2690203912
4 changed files with 36 additions and 31 deletions

18
urls.py
View File

@@ -10,7 +10,7 @@ from troggle.core.views import surveys, logbooks, other, caves, statistics, surv
from troggle.core.views.other import troggle404, frontpage
from troggle.core.views.caves import ent, prospecting_image
from troggle.core.views.statistics import pathsreport, stats
from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage
from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage, mediapage
from troggle.core.views.survex import survexcaveslist, survexcavesingle, svx
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
to resolve urls - in both directions as these are declarative.
@@ -40,7 +40,6 @@ else:
expofilesurls = [
url(r'^(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES
]
trogglepatterns = [
url(r'^expofiles/', include(expofilesurls)),
@@ -134,19 +133,10 @@ trogglepatterns = [
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
# url(r'^javascript/(?P<filepath>.*)$', surveys.expofilessingle, name="single"), # JSLIB_URL - Apache: Alias /javascript /usr/share/javascript
url(r'^photos/(?P<subpath>.*)$', mediapage, {'doc_root': settings.PHOTOS_ROOT}, name="mediapage"), # photo galleries
url(r'^site_media/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # MEDIA_ROOT: CSS and JS
url(r'^static/(?P<subpath>.*)$', mediapage, {'doc_root': settings.STATIC_ROOT}, name="mediapage"), # STATIC: CSS and JS
# static views not working, removed as a plugin. Use apache instead to serve these:
# url(r'^photos/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
# url(r'^gallery/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
# url(r'^site_media/(?P<filepath>.*)$', surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS
url(r'^(site_media/.*)$', expopage, name="expopage"), # MEDIA_ROOT: CSS and JS
# url(r'^static/(?P<filepath>.*)$', surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS
url(r'^(static/.*)$', expopage, name="expopage"), # STATIC: CSS and JS
url(r'^(.*)_edit$', editexpopage, name="editexpopage"),
url(r'^(.*)$', expopage, name="expopage"), # CATCHALL assumed relative to EXPOWEB