mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2026-02-24 21:25:19 +00:00
Moving docm to right place from the server README
This commit is contained in:
@@ -148,7 +148,7 @@ where it describes upgrading and testing with later versions of Django.
|
||||
<p>Follow this link to <a href="../computing/keyexchange.html">register a key with the expo server</a> to get git access if you have not already cloned the <var>:troggle:</var> repo.
|
||||
|
||||
<h4>git clone troggle</h4>
|
||||
<p>This creates a folder /troggle/ containing all the troggle code. </p>
|
||||
<p>You will do a git clone to create a folder /troggle/ containing all the troggle code. You need to clone the 'python-3' branch, if you an see multiple branches.</p>
|
||||
|
||||
<pre><code>cd ~
|
||||
cd ../expo
|
||||
@@ -168,26 +168,119 @@ sudo ln -s /mnt/c/EXPO/expowebcache expowebcache</code></pre>
|
||||
<pre><code>git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"</code></pre>
|
||||
|
||||
<h4>do the basic health checks</h4>
|
||||
<h4>do the basic Django health checks</h4>
|
||||
<p>This all checks that the installation has completed properly.
|
||||
<pre><code>django-admin
|
||||
python manage.py
|
||||
python manage.py check -v 3 --traceback</code></pre>
|
||||
<pre><code>django-admin</code></pre>
|
||||
<p>The first line <var>django-admin</var> will complain that it has not got a SETTINGS file, but that's fine.
|
||||
See <a href="djangostart.html">django-admin initial output</a> for what you should expect to see at this point.
|
||||
If it crashes though, you have not managed to install the software completely.
|
||||
<p>The most important is the <var>python manage.py check</var>. If this works, then you have installed the software correctly. Now we test whether troggle is configured correctly:
|
||||
If it crashes though, you have not managed to install the software completely.
|
||||
If you get an error when running
|
||||
<pre><code>django-admin</code></pre>
|
||||
Then run django-admin like this (using the python version you have installed in the folder underneath /lib/):
|
||||
<pre><code>python /usr/local/lib/python3.8/dist-packages/django/bin/django-admin.py</code></pre>
|
||||
which should fix the paths, but this means that you installed Django directly on your machine and not in a venv. From now on you should be able to run <var>django-admin </var>
|
||||
from within any folder on your machine.
|
||||
<p>Now try
|
||||
<pre><code>django-admin --version</code></pre>
|
||||
|
||||
The version number is the version of Django you have installed. Double check that it is the one you meant to install and check with <a href="trogdjangup.html">our Django versions page</a>.
|
||||
|
||||
<pre><code>python manage.py test -v 3 --traceback</code></pre>
|
||||
<p>This will run the entire troggle test suite of over 70 tests (it takes only a few seconds). It will probably have a dozen or so failures which will probably be because it can't find the various bits of the rest of the website. So the next task is to edit the SETTINGS files to match your machine and folder structure. So find the appropriate copy of the localsettings in /_deploy/ and copy it into the main troggle folder:
|
||||
<h4>do the basic troggle health checks</h4>
|
||||
<p>Now try
|
||||
<pre><code>python manage.py/code></code></pre>
|
||||
|
||||
You will get an error: No module named 'localsettings'. Fixing this is described below, but for now try:
|
||||
|
||||
<pre><code>python manage.py check -v 3 --traceback</code></pre><p>The most important is the <var>python manage.py check</var>. If this works, then you have installed the software correctly.
|
||||
<p>
|
||||
The next task is to edit the SETTINGS files to match your machine and folder structure. So find the appropriate copy of the localsettings in /_deploy/ and copy it into the main troggle folder:
|
||||
<pre><code>cp _deploy/wsl/localsettingsWSL.py localsettings.py</code></pre>
|
||||
<p>Now edit it and insert useful values for EXPOUSERPASS [e.g. cavey:beery], EXPOADMINUSERPASS [e.g. beery:cavey], SECRET_KEY and make sure that LIBDIR refers to the actual version of python you are using (sorry, this should be automatic).
|
||||
<p>Check that FILES and EXPOFILES are set to wherever you have put /expofiles/ or set 'EXPOFILESREMOTE = False' which will use expofiles on expo.survex.com instead.
|
||||
<p>Set <a href="https://docs.djangoproject.com/en/3.2/topics/email/#s-configuring-email-for-development">EMAIL_HOST and EMAIL_HOST_PASSWORD</a> to an email account you control that can send email. Then troggle can email you when some things go wrong. This may mean having to set EMAIL_PORT and MAIL_USE_TLS too (this is not used in troggle currently). Set EXPOUSER_EMAIL and EXPOADMINUSER_EMAIL to your own email address while you are doing software development. All these will be different when troggle is deployed on the public server.
|
||||
|
||||
<p>
|
||||
Now try this again:
|
||||
<pre><code>python manage.py</code></pre>
|
||||
|
||||
and in additon to the [django] command list, you will now gets command lists for [auth],
|
||||
[contenttypes], [core], and [sessions]. These are the modules (plugins) loaaded into django.
|
||||
[core] is the core of troggle (but not all of it: the input file parsers are not in [core]).
|
||||
|
||||
<pre><code>python manage.py check -v 3 --traceback</code></pre>
|
||||
|
||||
Ideally this will list settings imports and then say<br>
|
||||
<var>System check identified no issues (0 silenced)</var>.
|
||||
<p>
|
||||
If you get an error your python sys.path is probably not set correctly yet. Do
|
||||
<pre><code>python -m site</code></pre>
|
||||
when you are in your troggle directory to see the list of paths python looks
|
||||
for when it is searching for packages (both django and troggle). <br>
|
||||
Ensure that the path to the troggle/ directory is in the list.
|
||||
It should be at the top, which is where the current working directory is.
|
||||
<p>
|
||||
Now:
|
||||
<pre><code>python manage.py check -v 3 --deploy</code></pre>
|
||||
which will give security warnings for deployment. Various middleware settings and
|
||||
a warning not to use DEBUG=true in deployment. We always have DEBUG=True set for troggle
|
||||
as otherwise the users get useless error messages.
|
||||
|
||||
<pre><code>python -Wall manage.py check </code></pre>
|
||||
Gives warnings of deprecated Django which should be fixed. You should not get any on a fresh install but youwill see this message when you are trying to upgrade troggle to use later versions of Django.
|
||||
|
||||
If you got an error traceback with
|
||||
<pre><code>python manage.py</code></pre>
|
||||
then the settings registration of troggle with django is incomplete.
|
||||
Delete all your cached .pyc files and try again.
|
||||
You probably have a mistake in your settings.py or localsettings.py files.
|
||||
|
||||
<pre><code>python manage.py diffsettings</code></pre>
|
||||
This last one shows everything set in global settings, settings and localsettings.
|
||||
Anything different from global settings (django built-in) has '###' appended.
|
||||
|
||||
<pre><code>python manage.py help migrate
|
||||
python manage.py migrate</code></pre>
|
||||
Tests the uptodateness of your sqlite database. The help option
|
||||
explains what this does and gives extra command line options.
|
||||
|
||||
<h4>check full functionality</h4>
|
||||
<p>The test suite hardly skims the surface of what troggle does. You need to manually test all these too:
|
||||
|
||||
<p>Now run the test suite:
|
||||
|
||||
<pre><code>python manage.py test -v 3 --traceback</code></pre>
|
||||
<p>This will run the entire troggle test suite of over 70 tests (it takes only a few seconds).</code></pre>
|
||||
|
||||
<pre>
|
||||
If you get an error, and you probably will, have a look in the test file, e.g. for this error:
|
||||
FAIL: test_page_folk (troggle.core.TESTS.tests.PageTests)
|
||||
look in the file troggle/code/TESTS/tests.py in the class PageTests.
|
||||
It will also say:
|
||||
File "/mnt/c/EXPO/troggle/core/TESTS/tests.py", line 266, in test_page_folk
|
||||
which means that the asssert failure in on line 266 of troggle/code/TESTS/tests.py
|
||||
and that the failure function is test_page_folk()
|
||||
If you look at this you will see that line 264 is:
|
||||
response = self.client.get('/folk/index.htm')
|
||||
|
||||
so this file is missing. Duh. Of course it is. We downloaded troggle from git but we didn't run
|
||||
the standalone script to generate the folk list. It is top of the list in
|
||||
http://expo.survex.com/handbook/troggle/scriptscurrent.html#folk
|
||||
|
||||
So do this:
|
||||
cd ../expoweb/folk
|
||||
python ../scripts/make-folklist.py <folk.csv >index.htm
|
||||
cd ../../troggle
|
||||
|
||||
Or just sFTP a copy from expo.survex.com
|
||||
|
||||
and run the tests again:
|
||||
|
||||
python manage.py test -v 2
|
||||
|
||||
Yeah if you were paying attention, you will see that this has done a git commit for a test file
|
||||
in the drawings repo locally.
|
||||
Sorry about that. the test harness does not yet undo that. So you will need ot manually reverse that commit: go into your favourite git tool. In VS code the command is Commit: Undo last commit
|
||||
</pre>
|
||||
<p>The test suite has over 70 tests but does not cover all of what troggle does and does not use any real data. You need to manually test these too, after you have done a full data import:
|
||||
<br>- <var><a href="http://localhost:8000/pathsreport">http://localhost:8000/pathsreport</a></var>
|
||||
<br>- <var><a href="http://localhost:8000/stats">http://localhost:8000/stats</a></var>
|
||||
<br>- <var><a href="http://localhost:8000/people">http://localhost:8000/people</a></var> (takes a minute or so)
|
||||
|
||||
Reference in New Issue
Block a user