Why reverse-URL mapping is important

This commit is contained in:
Philip Sargent 2020-07-30 01:21:03 +01:00
parent 0a10cef8f7
commit c5dde279d8
3 changed files with 14 additions and 5 deletions

View File

@ -42,13 +42,14 @@ ALSO there have been tables added to the core representation which are not antic
<h3>Implementation in software</h3>
<p><a href="http://www.djangoproject.com/"><img class="onright" src="https://www.djangoproject.com/m/img/badges/djangopowered126x54.gif" border="0" alt="Powered by Django." title="Powered by Django." /></a>
Troggle is written in Python (about 5,700 lines excluding comments) and is built on the Django framework. Before starting to work on Troggle it might be a good idea to run through an initial install and exploration of <a href="https://code.djangoproject.com/wiki/Tutorials">a tutorial Django project</a> to get the Django concepts bedded down - which are not at all obvious and some exist only within Django.
Troggle is written in Python (about 6,400 lines excluding comments) and is built on the Django framework. Before starting to work on Troggle it might be a good idea to run through an initial install and exploration of <a href="https://code.djangoproject.com/wiki/Tutorials">a tutorial Django project</a> to get the Django concepts bedded down - which are not at all obvious and some exist only within Django.
<p>
Django is the thing that puts the survey data in a database in a way that helps us write far less code to get it in and out again, and provides templates which make it quicker to maintain all the webpages.
Django is the thing that puts the survey data in a database in a way that helps us write far less code to get it in and out again, and provides templates which make it quicker to maintain all the webpages.
See the <a href="https://docs.djangoproject.com/en/3.0/misc/design-philosophies/">django design philosophy</a> for why we chose it: while django comes with a full stack (db, request/response, URL mapping, HTML templates) the layers of the stack are independent and individually replaceable.
<p>We have to keep up to date with new rleases of django, see <a href="trogdjango.html">Upgrading Django for Troggle</a>.
<h3>Troggle parsers and input files</h3>
@ -82,9 +83,10 @@ Django is the thing that puts the survey data in a database in a way that helps
You will find it very useful to see what is going on if you look directly at the data in the database (just a single file in the sqlite case) and browse the data in the tables. A light-weight, simple db browser is <a href="https://sqlitebrowser.org/">DB Browser for SQLite</a>. Connecting directly the the MariaDB database with a control panel or <a href="https://www.mysql.com/products/workbench/">workbench</a> gives even more tools and documentation capabilities.
<hr />
Go on to: <a href="trognotes.html">Troggle uncategorised notes to be edited</a><br />
See: <a href="datamodel.html">Troggle data model</a> in python code <br />
Return to: <a href="trogintro.html">Troggle intro</a><br />
Troggle index:
<a href="trogindex.html">Index of all troggle documents</a><br />
<hr />
</body>
</html>

View File

@ -41,6 +41,11 @@
<p>[ However django-extensions looks like it could be useful explicitly to help us through the upgrade process:
<a href="https://pypi.org/project/django-extensions/">pypi.org/project/django-extensions/</a> (only available for django 2.2 and later). ]
<h4>Why we still use django</h4>
<p>Well we <a href="trog2030.html">might not use django indefinitely</a>, but unlike many frameworks the necessary functions are separately replaceable. So this gives us an evolution path.
<p>The stack is: database, request/response (GET/POST http),
<a href="https://docs.djangoproject.com/en/1.11/topics/http/urls/">URL mapping/dispatch</a> (declarative and bidrectional), and <a href="https://docs.djangoproject.com/en/3.0/topics/templates/">templates</a> (data to HTML). See the <a href="https://docs.djangoproject.com/en/3.0/misc/design-philosophies/">django design philosophy</a>. Note that having a URL dispatcher that supports <a href="https://docs.djangoproject.com/en/1.11/topics/http/urls#s-reverse-resolution-of-urls">reverse resolution</a> is important: it is a key reason why we need a framework and not just a mess of javascript. We have nearly 100 URL patterns.
<h3>Important Tricks</h3>
<p>There are five critical tricks that make everything much, much easier:
<ol>

View File

@ -65,7 +65,9 @@ statements. It takes a long time if memory is low and the operating system has t
<p>The file <var>import_profile.json</var> holds these historic times. Delete it to get
a clean slate.
<hr />
Return to: <a href="datamodel.html">Troggle data model</a> in python code <br />
Return to: <a href="trogintro.html">Troggle intro</a><br />
Troggle index:
<a href="trogindex.html">Index of all troggle documents</a><br />
<hr />
</body>
</html>