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

fix server instructions + comment in stats output

This commit is contained in:
Philip Sargent 2020-07-28 01:46:00 +01:00
parent 0094cf7054
commit 42456e8e98
4 changed files with 22 additions and 38 deletions

View File

@ -55,13 +55,11 @@ 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)
For Django 1.19 see below.
We are now using Django 1.11.29
Read this: https://docs.djangoproject.com/en/3.0/topics/install/
We are installing with python3.7.7 or 3.8.1
[ If you want to use python2.7 you presumably can work it out for yourself.
You should look at past revisions of this file in git to see what is required.
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.
@ -76,12 +74,13 @@ $ sudo apt install python3-pip
Now install django etc.
$ sudo pip3 install -r requirements.txt
where requirementsworks1.8.19.txt is:
Django==1.8.19
django-extensions==2.2.9
django-registration==2.4
where requirements.txt is:
confusable-homoglyphs==3.2.0
Django==1.11.29
django-registration==2.5.2
docutils==0.16
Pillow==7.1.2
six==1.15.0
pytz==2020.1
sqlparse==0.3.1
Unidecode==1.1.1
@ -89,10 +88,10 @@ if you don't use sudo it will install them all in ~/.local/
and so will only be available for you, not everyone; and
the paths won't work to find troggle properly.
six and Unidecode handle some of the python2-3 conversions
Unidecode handle some of the python2-3 conversions
and Pillow is an image handling package used to make
the prospecting map. tinymce is the wysiwyg in-browser
editor.
editor (disabled pending reinstatement)
$ pip3 list -o
will list all the pip python packages installed.
@ -116,26 +115,6 @@ but doesn't really work with python2.7 as you also need to obtain
an elderly version of pip that will work and use and older virtual
environment utility
Patching the django installation
--------------------------------
Since django 1.10 is out of update-support, and since python3 has progressed against
the 2015 version that django is expecting, you need to patch the django
installation after installing. In the troggle folder you will find
django-patch/html_parser.py
copy this over the installed version of django on your machine:
$ cd troggle
$ sudo cp django-patch/html_parser.py /usr/local/lib/python3.7/dist-packages/django/utils/
or
$ cp django-patch/html_parser.py ~/.local/lib/python3.7/site-packages/django/utils/
if you didn't use sudo when installing everything using pip.
or if you are using a venv, then
$ cd <venv directory>/troggle
$ cp django-patch/html_parser.py lib/python3.7/site-packages/django/utils/html_parser.py
that's it.
Testing the django installation
-------------------------------
Test things by running these commands:
@ -214,7 +193,7 @@ cssfilessingle() in core/view_surveys.py
Setting up survex
-----------------
You need to have survex installed as the command line tools 'cavern' and '3dtopos' are
You need to have survex installed as the command line tools 'cavern' is
used as part of the survex import process.
$ sudo apt install survex
@ -263,6 +242,11 @@ $ python manage.py runserver 8000 -v 3
from the troggle directory. This runs it on port 8000 so you see the website
at http://localhost:8000/
EXTRAS
------
cgit - https://git.zx2c4.com/cgit/about/
search - https://www.ibm.com/developerworks/opensource/library/os-xapianomega/index.html
Running a Troggle server with Apache
------------------------------------
Troggle also needs these aliases to be configured. These are set in

View File

@ -9,13 +9,13 @@
<h1>Troggle Code - README</h1>
<h2>Contents of README.txt file</h2>
<iframe name="erriframe" width="90%" height="45%"
<iframe name="erriframe" width="70%" height="500"
src="../readme.txt" frameborder="1" ></iframe>
<h2>Troggle documentation in the Expo Handbook</h2>
<ul>
<li><a href="http://expo.survex.com/handbook/troggle/trogintro.html">Intro</a>
<li><a href="http://expo.survex.com/handbook/troggle/trogmanual.html">Troggle manual</a>
<li><a href="http://expo.survex.com/handbook/troggle/trogindex.html">Troggle manual INDEX</a>
<li><a href="http://expo.survex.com/handbook/troggle/trogarch.html">Troggle data model</a>
<li><a href="http://expo.survex.com/handbook/troggle/trogimport.html">Troggle importing data</a>
<li><a href="http://expo.survex.com/handbook/troggle/trogdesign.html">Troggle design decisions</a>

View File

@ -100,7 +100,7 @@ SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
#SESSION_COOKIE_SECURE = True # if enabled, cannot login to Django control panel
CSRF_COOKIE_SECURE = True
X_FRAME_OPTIONS = 'SAMEORIGIN' # change to "DENY" after we eliminate all the iframes in use.
X_FRAME_OPTIONS = 'SAMEORIGIN' # change to "DENY" after we eliminate all the iframes e.g. /xmlvalid.html
INSTALLED_APPS = (
'django.contrib.admin',
@ -124,7 +124,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware', # Adds the user attribute, representing the currently-logged-in user, to every incoming HttpRequest
'django.contrib.admindocs.middleware.XViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', # Cookie-based and session-based message support
'django.middleware.clickjacking.XFrameOptionsMiddleware', # lickjacking protection via the X-Frame-Options header
'django.middleware.clickjacking.XFrameOptionsMiddleware', # clickjacking protection via the X-Frame-Options header
'troggle.middleware.SmartAppendSlashMiddleware' # Outdated & unneeded?
)

View File

@ -9,7 +9,7 @@
<p>{{ expoCount }} expeditions: {{ personCount }} people, {{ caveCount }} caves and {{ logbookEntryCount }} logbook entries.
<p>Number of survey legs: {{nsurvexlegs}}<br />
<p>Number of survey legs: {{nsurvexlegs}} &laquo;Removed from model, needs calculating..&raquo;<br />
Total length: {{addupsurvexlength|stringformat:".1f"}} km adding up the total for each year.</p>
<p>These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys.
@ -22,7 +22,7 @@ This is work in progress (July 2020).
<tr>
<td>{{legs.0.year}}</td>
<td style="text-align:center">{{legs.0.survexblock_set.all|length}}</td>
<td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"}}</td>
<td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"}} </td>
<td style="text-align:right">{{legs.1.survexleglength}}</td>
</tr>
{% endfor %}