summaryrefslogtreecommitdiffstats
path: root/urls.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-03-21 01:37:52 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2021-03-21 01:37:52 +0000
commita0c3ef8ea12ba3cfe232f7ed3e1df37f8ce653f7 (patch)
tree1c79f481c32f73ea08034a6cf626f4ccb8604e93 /urls.py
parentb4b343b5781c9f5607a2becd3c3c8575c6363990 (diff)
downloadtroggle-a0c3ef8ea12ba3cfe232f7ed3e1df37f8ce653f7.tar.gz
troggle-a0c3ef8ea12ba3cfe232f7ed3e1df37f8ce653f7.tar.bz2
troggle-a0c3ef8ea12ba3cfe232f7ed3e1df37f8ce653f7.zip
comments on urls resolution re apache & bugfix
Diffstat (limited to 'urls.py')
-rw-r--r--urls.py52
1 files changed, 35 insertions, 17 deletions
diff --git a/urls.py b/urls.py
index 46f1706..ebc73d2 100644
--- a/urls.py
+++ b/urls.py
@@ -1,5 +1,6 @@
from django.conf import settings
from django.conf.urls import url, include
+from django.views.generic.base import RedirectView
from django.views.generic.edit import UpdateView
from django.views.generic.list import ListView
from django.contrib import admin
@@ -11,10 +12,7 @@ from troggle.core.views_caves import ent, prospecting_image
from troggle.core.views_statistics import pathsreport, stats
from flatpages import views as flatviews
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
-to resolve urls - in both directions as these are declarative. It runs
-django autodiscover() first:
-https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#discovery-of-admin-files
-which may no longer be necessary in Django 1.11.29
+to resolve urls - in both directions as these are declarative.
HOW THIS WORKS
This is a "url dispatcher" - something needed by every web framework.
@@ -26,7 +24,7 @@ which is vital to writing code for the webapp. So the URL dispatch is declarativ
The API urls return TSV or JSON and are new in July 2020.
"""
-#admin.autodiscover()
+
# Many of these patterns do not work because troggle spent many years broken and we have
# not yet restored all the functions. Some may have never been fully implemented in
@@ -93,7 +91,7 @@ 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')), #LOGIN_URL = '/accounts/login/' # default
+ url(r'^accounts/', include('registration.backends.default.urls')), #LOGIN_URL = '/accounts/login/' # default
# url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then.
# url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map
@@ -104,29 +102,29 @@ actualurlpatterns = [
url(r'^survexfile/(?P<survex_file>.*?)\.log$', views_survex.svxraw),
url(r'^survexfile/(?P<survex_file>.*?)\.err$', views_survex.err),
- url(r'^survexfile/caves/$', views_survex.survexcaveslist, name="survexcaveslist"),
+ url(r'^survexfile/caves', views_survex.survexcaveslist, name="survexcaveslist"),
url(r'^survexfile/(?P<survex_cave>.*)$', views_survex.survexcavesingle, name="survexcavessingle"),
url(r'^survexfileraw/(?P<survex_file>.*?)\.svx$', views_survex.svxraw, name="svxraw"),
-# url(r'^survey_files/download/(?P<path>.*)$', view_surveys.download), # needs rewriting
+# url(r'^survey_files/download/(?P<path>.*)$', view_surveys.download), # needs rewriting
- url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"),
- url(r'^survey_scans/(?P<path>[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"),
+ url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"),
+ url(r'^survey_scans/(?P<path>[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"),
url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$',
- view_surveys.surveyscansingle, name="surveyscansingle"),
+ view_surveys.surveyscansingle, name="surveyscansingle"),
- url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"),
- url(r'^tunneldataraw/(?P<path>.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"),
-# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"),
- url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"),
+ url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"),
+ url(r'^tunneldataraw/(?P<path>.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"),
+# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"),
+ url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$', view_surveys.tunnelfileupload, name="tunnelfileupload"),
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
# use this next alternative if no local copy of expofiles.
url(r'^expofiles/(?P<path>.*)$', flatviews.expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles
url(r'^expofiles/(?P<filepath>.*)$',view_surveys.expofilessingle, name="single"), # local copy of EXPOFILES
-
-# url(r'^javascript/(?P<filepath>.*)$', view_surveys.cssfilessingle, name="single"), # JSLIB_URL - unused
+
+# url(r'^javascript/(?P<filepath>.*)$', view_surveys.cssfilessingle, name="single"), # JSLIB_URL - Apache: Alias /javascript /usr/share/javascript
# static views not working, removed as a plugin. Use apache instead to serve these:
# url(r'^photos/(?P<path>.*)$', staticviews.serve,
@@ -148,3 +146,23 @@ actualurlpatterns = [
urlpatterns = [
url('^%s' % settings.DIR_ROOT, include(actualurlpatterns))
]
+# When apache is running these prempt Django so Django never sees them.
+
+# NEW apache configurations suggested as of 20 March 2021:
+# Alias /site-media/ /home/expo/troggle/media/
+# Alias /robots.txt /home/expo/troggle/media/robots.txt
+# Alias /favicon.ico /home/expo/troggle/media/favicon.ico # comes from /expoweb/* when running runserver
+# Alias /javascript /home/expo/troggle/media/javascript
+
+# Copy of old standard apache configurations:
+# Alias /expofiles /home/expo/expofiles
+# Alias /photos /home/expo/webphotos
+# Alias /map /home/expo/expoweb/map
+# Alias /javascript /usr/share/javascript # to be changed
+# Alias /robots.txt /home/expo/static/robots.txt # to be changed
+# Alias /favicon.ico /home/expo/static/favicon.ico # to be changed
+# Alias /static/ /home/expo/static/
+
+# ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi
+# ScriptAlias /boe /home/expo/boe/boc/boc.pl
+# ScriptAlias /boe-lastyear /home/expo/boe/boc-previous/boc.pl