From d9c6986a892c47233a95081af94a1d2ea25a64ce Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 18 Jun 2020 21:50:16 +0100 Subject: static files redone --- urls.py | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'urls.py') diff --git a/urls.py b/urls.py index 6492538..4bea688 100644 --- a/urls.py +++ b/urls.py @@ -3,8 +3,10 @@ from django.conf.urls import * from django.views.generic.edit import UpdateView from django.views.generic.list import ListView from django.contrib import admin -from django.contrib.staticfiles import views as staticviews - +#from django.contrib.staticfiles import views as staticviews +#from django.conf.urls.static import static +from django.urls import reverse, resolve +# from .core.views import * # flat import from .core.views_other import * from .core.views_caves import * @@ -34,7 +36,7 @@ actualurlpatterns = [ # url(r'^personform/(.*)$', personForm), url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), - url(r'^expeditions/?$', views_logbooks.ExpeditionListView.as_view(), name="expeditions"), + url(r'^expeditions/?$', views_logbooks.ExpeditionListView.as_view(), name="expeditions"), url(r'^personexpedition/(?P[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P[A-Z]*[a-zA-Z&;]*)/(?P\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), url(r'^logbookentry/(?P.*)/(?P.*)/?$', views_logbooks.logbookentry,name="logbookentry"), url(r'^newlogbookentry/(?P.*)$', views_logbooks.newLogbookEntry, name="newLogBookEntry"), @@ -71,7 +73,8 @@ actualurlpatterns = [ url(r'^prospecting_guide/$', views_caves.prospecting), url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch), - url(r'^statistics/?$', views_statistics.stats, name="stats"), + url(r'^statistics/?$', views_statistics.stats, name="stats"), + url(r'^stats/?$', views_statistics.stats, name="stats"), url(r'^pathsreport.*$', views_statistics.pathsreport, name="pathsreport"), url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"), @@ -82,8 +85,8 @@ actualurlpatterns = [ url(r'^admin/doc/?', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/). url(r'^admin/', admin.site.urls), - url(r'^accounts/', include('registration.backends.default.urls')), - url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then. + url(r'^accounts/', include('registration.backends.default.urls')), # needed to log in! +# url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then. url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"), url(r'^survexfile/(?P.*?)\.svx$', views_survex.svx, name="svx"), @@ -95,39 +98,33 @@ actualurlpatterns = [ url(r'^survexfile/(?P.*)$', views_survex.survexcavesingle, name="survexcavessingle"), url(r'^survexfileraw/(?P.*?)\.svx$', views_survex.svxraw, name="svxraw"), - url(r'^survey_files/download/(?P.*)$', view_surveys.download), +# url(r'^survey_files/download/(?P.*)$', view_surveys.download), # needs rewriting - #(r'^survey_scans/(?P.*)$', 'django.views.static.serve', {'document_root': settings.SURVEY_SCANS, 'show_indexes':True}), url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"), url(r'^survey_scans/(?P[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"), - # This next line is beyond daft. If anyone uploads a file *anywhere* in SURVEY_SCANS which doesn't match, troggle crashes horribly. Has been failing for pdf and JPG files for years: - url(r'^survey_scans/(?P[^/]+)/(?P[^/]+(?:png|jpg|pdf|jpeg|PNG|JPG|PDF|JPEG))$', + url(r'^survey_scans/(?P[^/]+)/(?P[^/]+)$', view_surveys.surveyscansingle, name="surveyscansingle"), - url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"), -# url(r'^tunneldatainfo/(?P.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), - url(r'^tunneldataraw/(?P.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"), - url(r'^tunneldataraw/(?P.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"), + url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"), + url(r'^tunneldataraw/(?P.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"), +# url(r'^tunneldatainfo/(?P.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), + url(r'^tunneldataraw/(?P.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"), url(r'^prospecting/(?P[^.]+).png$', prospecting_image, name="prospecting_image"), - url(r'^expofiles/(?P.*)$', staticviews.serve, - {'document_root': settings.EXPOFILES, 'show_indexes': True}), - url(r'^static/(?P.*)$', staticviews.serve, - {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), - url(r'^site_media/(?P.*)$', staticviews.serve, - {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), -# url(r'^troggle/media-admin/(?P.*)$', staticviews.serve, -# {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}), - #url(r'^tinymce_media/(?P.*)$', staticviews.serve, - # {'document_root': settings.TINY_MCE_MEDIA_ROOT, 'show_indexes': True}), - #url(r'^photos/(?P.*)$', staticviews.serve, -# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), + url(r'^expofiles/(?P.*)$', view_surveys.expofilessingle, name="single"), # EXPOFILES + url(r'^static/(?P.*)$', view_surveys.cssfilessingle, name="single"), # MEDIA_ROOT: CSS and JS + url(r'^site_media/(?P.*)$', view_surveys.cssfilessingle, name="single"), # MEDIA_ROOT: CSS and JS +# url(r'^javascript/(?P.*)$', view_surveys.cssfilessingle, name="single"), # JSLIB_URL - unused + +# static views not working, removed as a plugin. Use apache instead to serve these: +# url(r'^photos/(?P.*)$', staticviews.serve, +# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), # url(r'^gallery/(?P.*)$', staticviews.serve, # {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), url(r'^(.*)_edit$', flatviews.editflatpage, name="editflatpage"), - url(r'^(.*)$', flatviews.flatpage, name="flatpage"), + url(r'^(.*)$', flatviews.flatpage, name="flatpage"), ] #Allow prefix to all urls -- cgit v1.2.3