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

JSLIB and tidy path settings

This commit is contained in:
Philip Sargent 2021-04-02 19:22:53 +01:00
parent 371542fb1e
commit 663d4a2a02
5 changed files with 43 additions and 26 deletions

View File

@ -314,7 +314,19 @@ class PageTests(TestCase):
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
if response.status_code != 302: if response.status_code != 302:
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.content), 39482 ) self.assertEqual(len(response.content), 39482 ) # need to check it is not just an error page
def test_page_site_media_css(self):
# Flat file tests.
response = self.client.get('/site_media/css/main3.css')
if response.status_code != 200:
self.assertEqual(response.status_code, 302)
if response.status_code != 302:
self.assertEqual(response.status_code, 200)
content = response.content.decode() # need to check it is not just an error page
ph = r'This text is used by the test system to determine that main3.css loaded correctly'
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
def test_page_photos_ok(self): def test_page_photos_ok(self):
# Flat file tests. # Flat file tests.
@ -323,7 +335,7 @@ class PageTests(TestCase):
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
if response.status_code != 302: if response.status_code != 302:
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.content), 67487 ) self.assertEqual(len(response.content), 67487 ) # need to check it is not just an error page
def test_page_photos_not_ok(self): def test_page_photos_not_ok(self):
# Flat file tests. # Flat file tests.

View File

@ -24,6 +24,7 @@ def pathsreport(request):
pathsdict = { pathsdict = {
# "BOGUS" : str( settings.BOGUS), # "BOGUS" : str( settings.BOGUS),
"JSLIB_URL" : str( settings.JSLIB_URL), "JSLIB_URL" : str( settings.JSLIB_URL),
"JSLIB_ROOT" : str( settings.JSLIB_ROOT),
# "CSSLIB_URL" : str( settings.CSSLIB_URL), # "CSSLIB_URL" : str( settings.CSSLIB_URL),
"CAVEDESCRIPTIONS" : str( settings.CAVEDESCRIPTIONS), "CAVEDESCRIPTIONS" : str( settings.CAVEDESCRIPTIONS),
"DIR_ROOT" : str( settings.DIR_ROOT), "DIR_ROOT" : str( settings.DIR_ROOT),
@ -60,6 +61,7 @@ def pathsreport(request):
pathstype = { pathstype = {
# "BOGUS" : type(settings.BOGUS), # "BOGUS" : type(settings.BOGUS),
"JSLIB_URL" : type(settings.JSLIB_URL), "JSLIB_URL" : type(settings.JSLIB_URL),
"JSLIB_ROOT" : str( settings.JSLIB_ROOT),
# "CSSLIB_URL" : type(settings.CSSLIB_URL), # "CSSLIB_URL" : type(settings.CSSLIB_URL),
"CAVEDESCRIPTIONS" : type(settings.CAVEDESCRIPTIONS), "CAVEDESCRIPTIONS" : type(settings.CAVEDESCRIPTIONS),
"DIR_ROOT" : type(settings.DIR_ROOT), "DIR_ROOT" : type(settings.DIR_ROOT),

View File

@ -2,7 +2,7 @@ html, body {
height: 100%; height: 100%;
} }
/* This text is used by the test system to determine that main3.css loaded correctly */
.caption { font-size: 8pt; margin-bottom: 0pt; } .caption { font-size: 8pt; margin-bottom: 0pt; }
.centre { text-align: center; } .centre { text-align: center; }
.plus2pt { font-size: 160%; } .plus2pt { font-size: 160%; }

View File

@ -13,18 +13,16 @@ python manage.py inspectdb > troggle-inspectdb.py
#egrep -in "unable|error" troggle-inspectdb.py #egrep -in "unable|error" troggle-inspectdb.py
echo remove passwords. echo remove passwords.
cp localsettings.py localsettingsWSL.py cp localsettings.py localsettingsWSL.py
grep EXPOUSERPASS localsettings*.py sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg - real-expo-password--is-imported-from-credentials.py"/' diffsettings.txt
sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' localsettings*.py echo " reset: EXPOUSERPASS = \"nnn:gggggg\" - real-expo-password--is-imported-from-credentials.py"
sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' diffsettings.txt
echo " " reset: EXPOUSERPASS = \"nnn:gggggg\" sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "real-email-password--is-imported-from-credentials.py"/' diffsettings.txt
grep EMAIL_HOST_PASSWORD localsettings*.py echo " reset: EMAIL_HOST_PASSWORD = \"real-email-password-is-imported-from-credentials.py\""
sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' localsettings*.py
sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' diffsettings.txt sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "real-SECRET_KEY-is-imported-from-credentials.py"/' diffsettings.txt
echo " " reset: EMAIL_HOST_PASSWORD = \"insert-real-email-password-here\" echo " reset: SECRET_KEY = \"real-SECRET_KEY-is-imported-from-credentials.py\""
grep SECRET_KEY *settings.*
sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' settings.py
sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' diffsettings.txt
echo " " reset: SECRET_KEY = \"not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2\"
# #
# Do these before final testing, *not* just before pushing: # Do these before final testing, *not* just before pushing:
# in ./pre-run.sh # in ./pre-run.sh

21
urls.py
View File

@ -34,7 +34,7 @@ The API urls return TSV or JSON and are new in July 2020.
if settings.EXPOFILESREMOTE: if settings.EXPOFILESREMOTE:
expofilesurls = [ expofilesurls = [
url(r'^(?P<path>.*)$', expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles url(r'^(?P<path>.*)$', expofiles_redirect, name="expofiles_redirect"), # to http://expo.survex.com/expofiles
] ]
else: else:
expofilesurls = [ expofilesurls = [
@ -111,6 +111,10 @@ trogglepatterns = [
# url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map # url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map
url(r'^prospecting_guide/$', caves.prospecting),
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
# The survexfile pages
url(r'^survexfile/(?P<survex_file>.*?)\.svx$', survex.svx, name="svx"), url(r'^survexfile/(?P<survex_file>.*?)\.svx$', survex.svx, name="svx"),
url(r'^survexfile/(?P<survex_file>.*?)\.3d$', survex.threed, name="threed"), url(r'^survexfile/(?P<survex_file>.*?)\.3d$', survex.threed, name="threed"),
url(r'^survexfile/(?P<survex_file>.*?)\.log$', survex.svxraw), url(r'^survexfile/(?P<survex_file>.*?)\.log$', survex.svxraw),
@ -124,21 +128,22 @@ trogglepatterns = [
url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$', url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$',
surveys.surveyscansingle, name="surveyscansingle"), surveys.surveyscansingle, name="surveyscansingle"),
# The tunnel drawings files pages
url(r'^tunneldata/$', surveys.tunneldata, name="tunneldata"), url(r'^tunneldata/$', surveys.tunneldata, name="tunneldata"),
url(r'^tunneldataraw/(?P<path>.+?\.xml)$', surveys.tunnelfilesingle, name="tunnelfile"), url(r'^tunneldataraw/(?P<path>.+?\.xml)$', surveys.tunnelfilesingle, name="tunnelfile"),
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', surveys.tunnelfileinfo, name="tunnelfileinfo"), # url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', surveys.tunnelfileinfo, name="tunnelfileinfo"), # parses tunnel for info
url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$', surveys.tunnelfileupload, name="tunnelfileupload"), url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$', surveys.tunnelfileupload, name="tunnelfileupload"),
url(r'^prospecting_guide/$', caves.prospecting), # This next set are all intercepted by Apache, if it is running.
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
url(r'^photos/(?P<subpath>.*)$', mediapage, {'doc_root': settings.PHOTOS_ROOT}, name="mediapage"), # photo galleries 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'^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.MEDIA_ROOT}, name="mediapage"), # STATIC is in MEDIA now! url(r'^static/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # STATIC is in MEDIA now!
url(r'^javascript/(?P<subpath>.*)$', mediapage, {'doc_root': settings.JSLIB_ROOT}, name="mediapage"), # JSLIB_URL
# This next is for shorthand references such as /1623/264
url(r'^(?P<karea>\d\d\d\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # Cave description url(r'^(?P<karea>\d\d\d\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # Cave description
# Final catchall which also serves expoweb handbook pages and images
url(r'^(.*)_edit$', editexpopage, name="editexpopage"), url(r'^(.*)_edit$', editexpopage, name="editexpopage"),
url(r'^(.*)$', expopage, name="expopage"), # CATCHALL assumed relative to EXPOWEB url(r'^(.*)$', expopage, name="expopage"), # CATCHALL assumed relative to EXPOWEB
] ]
@ -151,11 +156,11 @@ urlpatterns = [
# When apache is running these prempt Django so Django never sees them. # When apache is running these prempt Django so Django never sees them.
# NEW apache configurations suggested as of 20 March 2021: # NEW apache configurations suggested as of 2 April 2021:
# Alias /site-media/ /home/expo/troggle/media/ # Alias /site-media/ /home/expo/troggle/media/
# Alias /robots.txt /home/expo/troggle/media/robots.txt # 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 /favicon.ico /home/expo/troggle/media/favicon.ico # comes from /expoweb/* when running runserver
# Alias /javascript /home/expo/troggle/media/javascript # empty # Alias /javascript /home/expo/troggle/media/jslib # empty
# Copy of old standard apache configurations: # Copy of old standard apache configurations:
# Alias /expofiles /home/expo/expofiles # Alias /expofiles /home/expo/expofiles