From 32e6d5f89187fbc1fd8f5008afea7ff8afa1007b Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 20 Feb 2022 00:21:56 +0000 Subject: [PATCH] Update to-do lists and README text --- README.txt | 30 ++++++++++++------------------ media/readme.txt | 11 ++++++++++- settings.py | 3 +-- urls.py | 16 ++++++++-------- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/README.txt b/README.txt index e3bfb74..e6d8842 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -Updated 23 October 2021 +Updated 19 February 2022 Troggle is an application for caving expedition data management, originally created for use on Cambridge University Caving Club (CUCC)expeditions @@ -74,8 +74,14 @@ creates a barrier in itself. This is one reason most of us don't use Docker. CSS and media files ------------------- -Temporarily we are not using the STATICFILES capability but are instead -serving css files from troggle/media/.. (see urls.py) using +We are not using the STATICFILES capability. +We are serving css files from troggle/media/.. (see urls.py) + +Plain CSS pages +--------------- +When running the test server +manage.py runserver 0.0.0.0:8000 +and without Apache running, we are serving CSS using using this Django 'view': view_surveys.cssfilessingle i.e. cssfilessingle() in core/view_surveys.py @@ -175,20 +181,8 @@ WSGIScriptAlias / /home/expo/troggle/wsgi.py -Alias /expofiles /home/expo/expofiles -Alias /photos /home/expo/webphotos -Alias /map /home/expo/expoweb/map -Alias /javascript /usr/share/javascript -Alias /static/ /home/expo/static/ -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 faster for apache to serve them first: -Alias /expofiles /home/expo/expofiles -Alias /static/ /home/expo/static/ - +the instructions for apache Alias commands are in comments at the end of +the urls.py file. Unlike the django "manage.py runserver" method, apache requires a restart before it will use any changed files: @@ -205,7 +199,7 @@ olly: ExecReload=/usr/sbin/apachectl graceful Experimental additions ---------------------- -These are untried tools which help us document how troggle works. +These are untried tools which may help us document how troggle works in future. pip install pygraphviz pip install pyparsing pydot # installs fine diff --git a/media/readme.txt b/media/readme.txt index 82a12f2..b30fffb 100644 --- a/media/readme.txt +++ b/media/readme.txt @@ -2,6 +2,15 @@ Confusions and incompatibilities when migrating to Django 1.10 meant conslidating the places we get CSS files and site media such as gifs for page annoations. +Situation as of 19/2/2022: +The only use of STATIC or the /static/ path is by Django-provided admin pages which +we cannot chnage. +Locations of files are documented by comments at the bootom of the urls.py file. + +flatviews, flatpages are now called expoviews, expopages. + +we no longer load or use django.contrib.staticfiles + Situation as of 17/6/2020: We have 3 folders for CSS files in 3 very different places: 1 in expoweb repo @@ -17,7 +26,7 @@ These are (in /home/expo/ ): 2. troggle/media/css/ MEDIA_ROOT, MEDIA_URL - the url is /site_media/css/main3.css 3. static/admin/css STATIC_ROOT, STATIC_URL - the url is /static/admin/css/base.css -After installing Django, weneed to manually copy its CSS etc. files from, +After installing Django, we need to manually copy its CSS etc. files from, e.g. /usr/lib/python3.7/site-packages/django/contrib/admin/static/admin/css to /static/admin/css/base.css diff --git a/settings.py b/settings.py index a73e437..632ffbf 100644 --- a/settings.py +++ b/settings.py @@ -133,8 +133,7 @@ INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.admindocs', -# 'django.contrib.staticfiles', # Using workarounds with expopages - #'registration', # only for expo user. REPLACE using django.contrib.auth +# 'django.contrib.staticfiles', # We put our CSS etc explicitly in the right place so do not need this 'troggle.core', ) diff --git a/urls.py b/urls.py index 9dbfe16..eaaf3e8 100644 --- a/urls.py +++ b/urls.py @@ -164,7 +164,7 @@ trogglepatterns = [ # The tunnel and therion drawings files pages path('dwgfiles', dwgallfiles, name="dwgallfiles"), - path('dwgfiles/', dwgallfiles, name="dwgallfiles"), + path('dwgfiles/', dwgallfiles, name="dwgallfiles"), path('dwgdataraw/', dwgfilesingle, name="dwgfilesingle"), # QMs pages - must precede other /caves pages? @@ -177,7 +177,7 @@ trogglepatterns = [ # This next set are all intercepted by Apache, if it is running. re_path(r'^photos/(?P.*)$', mediapage, {'doc_root': settings.PHOTOS_ROOT}, name="mediapage"), # photo galleries re_path(r'^site_media/(?P.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # MEDIA_ROOT: CSS and JS - re_path(r'^static/(?P.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # STATIC is in MEDIA now! + re_path(r'^static/(?P.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # STATIC only used by admin pages path('javascript/', mediapage, {'doc_root': settings.JSLIB_ROOT}, name="mediapage"), # JSLIB_URL re_path(r'^expowebcache/3d/(?P.*)$', mediapage, {'doc_root': settings.THREEDCACHEDIR}, name="mediapage"), @@ -201,7 +201,7 @@ urlpatterns = [ # NEW apache configurations suggested as of 2 April 2021: # Alias /site-media/ /home/expo/troggle/media/ -# Alias /robots.txt /home/expo/troggle/media/robots.txt +# Alias /robots.txt /home/expo/troggle/media/robots.txt # does not exist! # Alias /favicon.ico /home/expo/troggle/media/favicon.ico # comes from /expoweb/* when running runserver # Alias /javascript /home/expo/troggle/media/jslib # empty @@ -209,11 +209,11 @@ urlpatterns = [ # Alias /expofiles /home/expo/expofiles # Alias /photos /home/expo/webphotos # Alias /map /home/expo/expoweb/map -# Alias /javascript /usr/share/javascript # to be changed -# Alias /robots.txt /home/expo/static/robots.txt # to be changed -# Alias /favicon.ico /home/expo/static/favicon.ico # to be changed -# Alias /static/ /home/expo/static/ +# Alias /javascript /usr/share/javascript # to be changed, see above +# Alias /robots.txt /home/expo/static/robots.txt # to be changed, see above +# Alias /favicon.ico /home/expo/static/favicon.ico # to be deleted. favicon.ico now in expoweb/ +# Alias /static/ /home/expo/static/ # only used by Django admin, tinymce -# ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi # UPDATE thios for git +# ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi # UPDATE this for git # ScriptAlias /boe /home/expo/boe/boc/boc.pl # ScriptAlias /boe-lastyear /home/expo/boe/boc-previous/boc.pl