From 291e3baabf09ccfd063c54db18f5db9018152a11 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Fri, 21 Feb 2020 14:19:37 +0000 Subject: [PATCH] Get media working (at least in development) --- templates/base.html | 12 ++++++------ urls.py | 45 +++++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/templates/base.html b/templates/base.html index e160b76..c5943d5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,14 +2,14 @@ - - - + + + {% block title %}Troggle{% endblock %} - - - + + + {% block head %}{% endblock %} diff --git a/urls.py b/urls.py index 3ad52e5..263da81 100644 --- a/urls.py +++ b/urls.py @@ -1,6 +1,7 @@ from django.conf.urls import * from django.conf import settings from django.conf.urls.static import static +from django.views.static import serve from core.views import * # flat import from core.views_other import * @@ -12,7 +13,7 @@ from django.views.generic.edit import UpdateView from django.contrib import admin from django.views.generic.list import ListView from django.contrib import admin -admin.autodiscover() +#admin.autodiscover() # type url probably means it's used. @@ -22,23 +23,23 @@ admin.autodiscover() # ) actualurlpatterns = [ - + url(r'^testingurl/?$' , views_caves.millenialcaves, name="testing"), url(r'^millenialcaves/?$', views_caves.millenialcaves, name="millenialcaves"), - + url(r'^troggle$', views_other.frontpage, name="frontpage"), url(r'^todo/$', views_other.todo, name="todo"), - - url(r'^caves/?$', views_caves.caveindex, name="caveindex"), + + url(r'^caves/?$', views_caves.caveindex, name="caveindex"), url(r'^people/?$', views_logbooks.personindex, name="personindex"), url(r'^newqmnumber/?$', views_other.ajax_QM_number, ), - url(r'^lbo_suggestions/?$', logbook_entry_suggestions), + url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #(r'^person/(?P\d*)/?$', views_logbooks.person), url(r'^person/(?P[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', views_logbooks.person, name="person"), #url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"), - + url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), 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"), @@ -53,7 +54,7 @@ actualurlpatterns = [ url(r'^getPeople/(?P.*)', views_logbooks.get_people, name = "get_people"), url(r'^getLogBookEntries/(?P.*)', views_logbooks.get_logbook_entries, name = "get_logbook_entries"), - + url(r'^cave/new/$', views_caves.edit_cave, name="newcave"), url(r'^cave/(?P[^/]+)/?$', views_caves.cave, name="cave"), url(r'^caveslug/([^/]+)/?$', views_caves.caveSlug, name="caveSlug"), @@ -83,24 +84,24 @@ actualurlpatterns = [ url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch), url(r'^statistics/?$', views_other.stats, name="stats"), - + url(r'^survey/?$', surveyindex, name="survey"), url(r'^survey/(?P\d\d\d\d)\#(?P\d*)$', survey, name="survey"), url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"), - url(r'^CAVETAB2\.CSV/?$', views_other.downloadCavetab, name="downloadcavetab"), + url(r'^CAVETAB2\.CSV/?$', views_other.downloadCavetab, name="downloadcavetab"), url(r'^Surveys\.csv/?$', views_other.downloadSurveys, name="downloadsurveys"), url(r'^logbook(?P\d\d\d\d)\.(?P.*)/?$',views_other.downloadLogbook), url(r'^logbook/?$',views_other.downloadLogbook, name="downloadlogbook"), - url(r'^cave/(?P[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"), + url(r'^cave/(?P[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"), url(r'^downloadqms$', views_other.downloadQMs), - + url(r'^eyecandy$', views_other.eyecandy), url(r'^admin/doc/?', include('django.contrib.admindocs.urls')), #url(r'^admin/(.*)', admin.site.get_urls, name="admin"), url(r'^admin/', include(admin.site.urls)), - + # don't know why this needs troggle/ in here. nice to get it out # url(r'^troggle/media-admin/(?P.*)$', static, {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}), @@ -111,7 +112,7 @@ actualurlpatterns = [ # (r'^personform/(.*)$', personForm), - url(r'^site_media/(?P.*)$', static, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), + url(r'^site_media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"), url(r'^survexfile/(?P.*?)\.svx$', views_survex.svx, name="svx"), @@ -130,16 +131,16 @@ actualurlpatterns = [ #(r'^survey_files/upload/(?P.*)$', view_surveys.upload), #(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"), - url(r'^survey_scans/(?P[^/]+)/(?P[^/]+(?:png|jpg|jpeg))$', - view_surveys.surveyscansingle, name="surveyscansingle"), + url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"), + url(r'^survey_scans/(?P[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"), + url(r'^survey_scans/(?P[^/]+)/(?P[^/]+(?:png|jpg|jpeg))$', + view_surveys.surveyscansingle, name="surveyscansingle"), - url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"), - 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'^tunneldataraw/(?P.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"), - #url(r'^tunneldatainfo/(?P.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), + #url(r'^tunneldatainfo/(?P.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), # url(r'^photos/(?P.*)$', 'django.views.static.serve', {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),