2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

comments on urls resolution re apache & bugfix

This commit is contained in:
Philip Sargent 2021-03-21 01:37:52 +00:00
parent b4b343b578
commit a0c3ef8ea1
3 changed files with 48 additions and 29 deletions

View File

@ -38,6 +38,8 @@ ADMINS = (
)
MANAGERS = ADMINS
#LOGIN_URL = '/accounts/login/' # this is the default value so does not need to be set
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
@ -62,6 +64,7 @@ FIX_PERMISSIONS = []
# top-level survex file basename (without .svx)
SURVEX_TOPNAME = "1623"
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
DEFAULT_LOGBOOK_PARSER = "Parseloghtmltxt"
DEFAULT_LOGBOOK_FILE = "logbook.html"
# All years since 2010 use the default value for Logbook parser
@ -117,11 +120,11 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.admindocs',
# 'django.contrib.staticfiles', # apparently not working. Using workarounds with flatpages
'registration', # only for expo user. REPLACE with another non-admin, contrib.auth user ?
'troggle.profiles', # Probably don't need this at all
# 'django.contrib.staticfiles', # Using workarounds with flatpages
'registration', # only for expo user. REPLACE using django.contrib.auth
'troggle.core',
'troggle.flatpages', # NOT django.contrib.flatpages.models.FlatPage Merge in with troggle ?
'troggle.flatpages', # Written by Martin Green 2011. This is NOT django.contrib.flatpages which stores HTML in the database
# 'troggle.profiles', # Commented out, but keep until user/login system fully bedded down.
)
MIDDLEWARE_CLASSES = (
@ -146,7 +149,7 @@ AUTH_PROFILE_MODULE = 'core.person'
QM_PATTERN="\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]"
# Re-enable TinyMCE when Dj upgraded to v3. Also templates/editflatpage.html
# TINYMCE_DEFAULT_CONFIG = {
# 'plugins': "table,spellchecker,paste,searchreplace",
# 'theme': "advanced",
@ -154,8 +157,6 @@ QM_PATTERN="\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]"
# TINYMCE_SPELLCHECKER = False
# TINYMCE_COMPRESSOR = True
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
from localsettings import *

View File

@ -4,9 +4,9 @@
{% block title %}{{ title }}{% endblock %}
{% block head %}
<script src="{{ settings.MEDIA_URL }}js/base.js" type="text/javascript"></script>
<script type="text/javascript" src="{{settings.JSLIB_URL}}jquery-form/jquery.form.min.js"></script>
<script type="text/javascript" src="{{settings.JSLIB_URL}}codemirror/codemirror.min.js"></script>
<script type="text/javascript" src="{{settings.MEDIA_URL }}js/base.js"></script>
<script type="text/javascript" src="{{settings.JSLIB_URL}}jquery-form/jquery.form.min.js"></script> <!-- INVALID-->
<script type="text/javascript" src="{{settings.JSLIB_URL}}codemirror/codemirror.min.js"></script> <!-- INVALID-->
<script type="text/javascript">
var codeeditor;
@ -15,8 +15,8 @@ $(document).ready(function()
codeeditor = CodeMirror.fromTextArea("id_code",
{
parserfile: ["parsesurvex.js"],
stylesheet: "{{settings.MEDIA_URL}}CodeMirror-0.62/css/survexcolors.css",
path: "{{settings.MEDIA_URL}}CodeMirror-0.62/js/",
stylesheet: "{{settings.MEDIA_URL}}CodeMirror-0.62/css/survexcolors.css", # INVALID
path: "{{settings.MEDIA_URL}}CodeMirror-0.62/js/", # INVALID
textWrapping: false,
lineNumbers: false,
indentUnit: 4,

34
urls.py
View File

@ -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
@ -104,7 +102,7 @@ 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"),
@ -118,7 +116,7 @@ actualurlpatterns = [
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'^tunneldataraw/(?P<path>.+?\.xml)/upload$', view_surveys.tunnelfileupload, name="tunnelfileupload"),
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
@ -126,7 +124,7 @@ actualurlpatterns = [
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