From 2fe2c0515fa5ed4b39d90108087f5685ac077cd2 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 24 Mar 2021 20:38:43 +0000 Subject: [PATCH] update push procedure and fix order in pathsreport --- README.txt | 8 ++-- core/views_statistics.py | 79 ++++++++++++++++++++++------------------ pre-run.sh | 1 + requirements.txt | 1 - 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/README.txt b/README.txt index d9f95ea..7582003 100644 --- a/README.txt +++ b/README.txt @@ -3,7 +3,7 @@ originally created for use on Cambridge University Caving Club (CUCC)expeditions and licensed under the GNU Lesser General Public License. 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/ 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 ----------------------------------- -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 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 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 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). 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 /static/ /home/expo/static/ diff --git a/core/views_statistics.py b/core/views_statistics.py index 8fb968d..98e0fde 100644 --- a/core/views_statistics.py +++ b/core/views_statistics.py @@ -1,6 +1,7 @@ import datetime import os.path import re +from collections import OrderedDict import django.db.models from django.db.models import Min, Max @@ -18,51 +19,59 @@ import troggle.settings as settings def pathsreport(request): - pathsdict={} + pathsdict = OrderedDict() try: - pathsdict={ -# "BOGUS" : settings.BOGUS, - "CAVEDESCRIPTIONS" : settings.CAVEDESCRIPTIONS, - "DIR_ROOT" : settings.DIR_ROOT, - "ENTRANCEDESCRIPTIONS" : settings.ENTRANCEDESCRIPTIONS, - "EXPOUSER_EMAIL" : settings.EXPOUSER_EMAIL, - "EXPOUSERPASS" :"", - "EXPOUSER" : settings.EXPOUSER, - "EXPOWEB" : settings.EXPOWEB, - "EXPOWEB_URL" : settings.EXPOWEB_URL, - "FILES" : settings.FILES, - "JSLIB_URL" : settings.JSLIB_URL, - "LOGFILE" : settings.LOGFILE, - "LOGIN_REDIRECT_URL" : settings.LOGIN_REDIRECT_URL, - "MEDIA_ROOT" : settings.MEDIA_ROOT, - "MEDIA_URL" : settings.MEDIA_URL, - "PHOTOS_URL" : settings.PHOTOS_URL, - "PYTHON_PATH" : settings.PYTHON_PATH, - "REPOS_ROOT_PATH" : settings.REPOS_ROOT_PATH, - "ROOT_URLCONF" : settings.ROOT_URLCONF, - "STATIC_URL" : settings.STATIC_URL, - "SURVEX_DATA" : settings.SURVEX_DATA, - "SURVEY_SCANS" : settings.SURVEY_SCANS, - "SURVEYS" : settings.SURVEYS, - "SURVEYS_URL" : settings.SURVEYS_URL, - "THREEDCACHEDIR" : settings.THREEDCACHEDIR, - "TUNNEL_DATA" : settings.TUNNEL_DATA, - "URL_ROOT" : settings.URL_ROOT + pathsdict = { +# "BOGUS" : str( settings.BOGUS), + "JSLIB_URL" : str( settings.JSLIB_URL), +# "CSSLIB_URL" : str( settings.CSSLIB_URL), + "CAVEDESCRIPTIONS" : str( settings.CAVEDESCRIPTIONS), + "DIR_ROOT" : str( settings.DIR_ROOT), + "ENTRANCEDESCRIPTIONS" : str( settings.ENTRANCEDESCRIPTIONS), + "EXPOUSER_EMAIL" : str( settings.EXPOUSER_EMAIL), + "EXPOUSERPASS" : str(""), + "EXPOUSER" : str( settings.EXPOUSER), + "EXPOWEB" : str( settings.EXPOWEB), + "EXPOWEB_URL" : str( settings.EXPOWEB_URL), + "FILES" : str( settings.FILES), + "LOGFILE" : str( settings.LOGFILE), + "LOGIN_REDIRECT_URL" : str( settings.LOGIN_REDIRECT_URL), + "MEDIA_ROOT" : str( settings.MEDIA_ROOT), + "MEDIA_URL" : str( settings.MEDIA_URL), + "PHOTOS_URL" : str( settings.PHOTOS_URL), + "PYTHON_PATH" : str( settings.PYTHON_PATH), + "REPOS_ROOT_PATH" : str( settings.REPOS_ROOT_PATH), + "ROOT_URLCONF" : str( settings.ROOT_URLCONF), + "STATIC_URL" : str( settings.STATIC_URL), + "SURVEX_DATA" : str( settings.SURVEX_DATA), + "SURVEY_SCANS" : str( settings.SURVEY_SCANS), + "SURVEYS" : str( settings.SURVEYS), + "SURVEYS_URL" : str( settings.SURVEYS_URL), + "SURVEXPORT" : str( settings.SURVEXPORT), + "THREEDCACHEDIR" : str( settings.THREEDCACHEDIR), + "TUNNEL_DATA" : str( settings.TUNNEL_DATA), + "URL_ROOT" : str( settings.URL_ROOT) } except: pathsdict["! EXCEPTION !"] = "missing string constant in troggle/settings" # settings are unique by paths are not 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 = [] + + 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 - for key, value in pathsdict.items(): - tmptuple = (key, value) - bypathslist.append(tmptuple) - # bypathslist = sorted(bypathslist) + #f#=or w in bypaths: + # bypathslist[w] = pathsdict[w] return render(request, 'pathsreport.html', { "pathsdict":pathsdict, diff --git a/pre-run.sh b/pre-run.sh index c930b21..53e3c1c 100755 --- a/pre-run.sh +++ b/pre-run.sh @@ -21,3 +21,4 @@ python3 manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null python3 manage.py check -v 3 --deploy echo "" 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. diff --git a/requirements.txt b/requirements.txt index 7438472..92e6601 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,3 @@ docutils==0.16 Pillow==7.2.0 pytz==2020.1 Unidecode==1.1.1 -Unipath==1.1