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

update push procedure and fix order in pathsreport

This commit is contained in:
Philip Sargent 2021-03-24 20:38:43 +00:00
parent ecbef84c37
commit 2fe2c0515f
4 changed files with 49 additions and 40 deletions

View File

@ -3,7 +3,7 @@ originally created for use on Cambridge University Caving Club (CUCC)expeditions
and licensed under the GNU Lesser General Public License. and licensed under the GNU Lesser General Public License.
Troggle has been forked into two projects. The original one is maintained by Aron Curtis Troggle has been forked into two projects. The original one is maintained by Aron Curtis
and is used for Erebus caves. The CUCC variant uses files as the definitive data, and was used for Erebus caves. The CUCC variant uses files as the definitive data,
not the database and lives at http://expo.survex.com/repositories/troggle/.git/ not the database and lives at http://expo.survex.com/repositories/troggle/.git/
See copyright notices in See copyright notices in
@ -57,7 +57,7 @@ Follow the instructions contained in the file to fill out your settings.
Python3, Django, and Database setup Python3, Django, and Database setup
----------------------------------- -----------------------------------
Troggle with python3 requires Django 1.8.19 (16 June 2019) First version of troggle using python3 required Django 1.8.19 (16 June 2019)
We are now using Django 1.11.29 We are now using Django 1.11.29
Read this: https://docs.djangoproject.com/en/3.0/topics/install/ Read this: https://docs.djangoproject.com/en/3.0/topics/install/
@ -65,7 +65,7 @@ Read this: https://docs.djangoproject.com/en/3.0/topics/install/
We are installing with python3.7.5 We are installing with python3.7.5
Also : https://linuxize.com/post/how-to-install-pip-on-ubuntu-20.04/ ] Also : https://linuxize.com/post/how-to-install-pip-on-ubuntu-20.04/ ]
Install Django using pip, not with apt. Install Django using pip, not with apt, on your test system.
Your Linux installation almost certainly already includes python3 and pip3 but Your Linux installation almost certainly already includes python3 and pip3 but
in case it doesn't install those like this: in case it doesn't install those like this:
@ -282,7 +282,7 @@ ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi
(The last is just for mercurial which will be remoived during 2020). (The last is just for mercurial which will be remoived during 2020).
These two are not necessary as Django will serve these (see urls.py), but These two are not necessary as Django will serve these (see urls.py), but
it may be very slightly faster for apache to serve them first: it may be faster for apache to serve them first:
Alias /expofiles /home/expo/expofiles Alias /expofiles /home/expo/expofiles
Alias /static/ /home/expo/static/ Alias /static/ /home/expo/static/

View File

@ -1,6 +1,7 @@
import datetime import datetime
import os.path import os.path
import re import re
from collections import OrderedDict
import django.db.models import django.db.models
from django.db.models import Min, Max from django.db.models import Min, Max
@ -18,51 +19,59 @@ import troggle.settings as settings
def pathsreport(request): def pathsreport(request):
pathsdict={} pathsdict = OrderedDict()
try: try:
pathsdict={ pathsdict = {
# "BOGUS" : settings.BOGUS, # "BOGUS" : str( settings.BOGUS),
"CAVEDESCRIPTIONS" : settings.CAVEDESCRIPTIONS, "JSLIB_URL" : str( settings.JSLIB_URL),
"DIR_ROOT" : settings.DIR_ROOT, # "CSSLIB_URL" : str( settings.CSSLIB_URL),
"ENTRANCEDESCRIPTIONS" : settings.ENTRANCEDESCRIPTIONS, "CAVEDESCRIPTIONS" : str( settings.CAVEDESCRIPTIONS),
"EXPOUSER_EMAIL" : settings.EXPOUSER_EMAIL, "DIR_ROOT" : str( settings.DIR_ROOT),
"EXPOUSERPASS" :"<redacted>", "ENTRANCEDESCRIPTIONS" : str( settings.ENTRANCEDESCRIPTIONS),
"EXPOUSER" : settings.EXPOUSER, "EXPOUSER_EMAIL" : str( settings.EXPOUSER_EMAIL),
"EXPOWEB" : settings.EXPOWEB, "EXPOUSERPASS" : str("<redacted>"),
"EXPOWEB_URL" : settings.EXPOWEB_URL, "EXPOUSER" : str( settings.EXPOUSER),
"FILES" : settings.FILES, "EXPOWEB" : str( settings.EXPOWEB),
"JSLIB_URL" : settings.JSLIB_URL, "EXPOWEB_URL" : str( settings.EXPOWEB_URL),
"LOGFILE" : settings.LOGFILE, "FILES" : str( settings.FILES),
"LOGIN_REDIRECT_URL" : settings.LOGIN_REDIRECT_URL, "LOGFILE" : str( settings.LOGFILE),
"MEDIA_ROOT" : settings.MEDIA_ROOT, "LOGIN_REDIRECT_URL" : str( settings.LOGIN_REDIRECT_URL),
"MEDIA_URL" : settings.MEDIA_URL, "MEDIA_ROOT" : str( settings.MEDIA_ROOT),
"PHOTOS_URL" : settings.PHOTOS_URL, "MEDIA_URL" : str( settings.MEDIA_URL),
"PYTHON_PATH" : settings.PYTHON_PATH, "PHOTOS_URL" : str( settings.PHOTOS_URL),
"REPOS_ROOT_PATH" : settings.REPOS_ROOT_PATH, "PYTHON_PATH" : str( settings.PYTHON_PATH),
"ROOT_URLCONF" : settings.ROOT_URLCONF, "REPOS_ROOT_PATH" : str( settings.REPOS_ROOT_PATH),
"STATIC_URL" : settings.STATIC_URL, "ROOT_URLCONF" : str( settings.ROOT_URLCONF),
"SURVEX_DATA" : settings.SURVEX_DATA, "STATIC_URL" : str( settings.STATIC_URL),
"SURVEY_SCANS" : settings.SURVEY_SCANS, "SURVEX_DATA" : str( settings.SURVEX_DATA),
"SURVEYS" : settings.SURVEYS, "SURVEY_SCANS" : str( settings.SURVEY_SCANS),
"SURVEYS_URL" : settings.SURVEYS_URL, "SURVEYS" : str( settings.SURVEYS),
"THREEDCACHEDIR" : settings.THREEDCACHEDIR, "SURVEYS_URL" : str( settings.SURVEYS_URL),
"TUNNEL_DATA" : settings.TUNNEL_DATA, "SURVEXPORT" : str( settings.SURVEXPORT),
"URL_ROOT" : settings.URL_ROOT "THREEDCACHEDIR" : str( settings.THREEDCACHEDIR),
"TUNNEL_DATA" : str( settings.TUNNEL_DATA),
"URL_ROOT" : str( settings.URL_ROOT)
} }
except: except:
pathsdict["! EXCEPTION !"] = "missing string constant in troggle/settings" pathsdict["! EXCEPTION !"] = "missing string constant in troggle/settings"
# settings are unique by paths are not # settings are unique by paths are not
ncodes = len(pathsdict) ncodes = len(pathsdict)
bycodeslist = sorted(pathsdict.items()) bycodeslist = sorted(pathsdict.items()) # a list of tuples
bypaths = sorted(pathsdict.values()) # a list
# create a temporary list
bypathslist = [] bypathslist = []
for p in bypaths:
for k in pathsdict.keys():
if pathsdict[k] == p:
bypathslist.append((p, k))
del pathsdict[k]
break
#bypaths = sorted(bycodeslist, key=bycodeslist[1])
# iterate through the dictionary and append each tuple into the temporary list # iterate through the dictionary and append each tuple into the temporary list
for key, value in pathsdict.items(): #f#=or w in bypaths:
tmptuple = (key, value) # bypathslist[w] = pathsdict[w]
bypathslist.append(tmptuple)
# bypathslist = sorted(bypathslist)
return render(request, 'pathsreport.html', { return render(request, 'pathsreport.html', {
"pathsdict":pathsdict, "pathsdict":pathsdict,

View File

@ -21,3 +21,4 @@ python3 manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null
python3 manage.py check -v 3 --deploy python3 manage.py check -v 3 --deploy
echo "" echo ""
echo `tail -1 lines-of-python.txt` non-comment lines of python. echo `tail -1 lines-of-python.txt` non-comment lines of python.
echo `tail -1 lines-of-templates.txt` non-comment lines of HTML templates.

View File

@ -5,4 +5,3 @@ docutils==0.16
Pillow==7.2.0 Pillow==7.2.0
pytz==2020.1 pytz==2020.1
Unidecode==1.1.1 Unidecode==1.1.1
Unipath==1.1