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

LIBDIR automatically gets right python version

This commit is contained in:
Philip Sargent 2022-02-25 18:33:34 +00:00
parent 2c13c1b5f3
commit 7f542b8936
3 changed files with 20 additions and 13 deletions

View File

@ -15,6 +15,7 @@ a system-wide location rather than just a local directory.
This file is included at the end of the main troggle/settings.py file so that
it overwrites defaults in that file.
Read https://realpython.com/python-pathlib/
Read https://adamj.eu/tech/2020/03/16/use-pathlib-in-your-django-project/
"""
@ -37,19 +38,24 @@ EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote se
SERVERPORT = '8000' # not needed
PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
# Troggle does a lot of file-handling. This is very error-prone when using primitive methods,
# so we use pathlib which has been standard since python 3.4
# If oathlib is new to you, you will need to read https://realpython.com/python-pathlib/
# --------------------- MEDIA redirections BEGIN ---------------------
#REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/t37/'
REPOS_ROOT_PATH = Path(__file__).parent.parent # We are assuming all 4 repos are siblings.
version = sys.version_info
#LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python{}.{}'.format(version.major, version.minor) # eg python 3.7
REPOS_ROOT_PATH = Path(__file__).parent.parent
LIBDIR = REPOS_ROOT_PATH / 'lib' / PV
#LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python3.7' # should be finding this automatically: python --version etc.
TROGGLE_PATH = Path(__file__).parent
TEMPLATE_PATH = TROGGLE_PATH / 'templates'
MEDIA_ROOT = TROGGLE_PATH / 'media'
JSLIB_ROOT = TROGGLE_PATH / 'media' / 'jslib' # used for CaveViewer JS utility
FILES = Path('/mnt/c/EXPO/expofiles/')
EXPOFILES = Path('/mnt/c/EXPO/expofiles/')
FILES = Path('/mnt/f/expofiles/')
EXPOFILES = Path('/mnt/f/expofiles/')
SURVEY_SCANS = EXPOFILES / 'surveyscans'
PHOTOS_ROOT = EXPOFILES / 'photos'
@ -117,7 +123,7 @@ TEMPLATES = [
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media', # includes a variable MEDIA_URL
'django.template.context_processors.static', # includes a variable STATIC_URL
'django.template.context_processors.static', # includes a variable STATIC_URL used by admin pages
'django.template.context_processors.tz',
'django.template.context_processors.request', # must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin navigation sidebar.
'django.contrib.messages.context_processors.messages',
@ -144,7 +150,6 @@ EMAIL_HOST_USER = "django-test@klebos.net" # Philip Sargent really
EMAIL_PORT=587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'django-test@klebos.net'
EMAIL_SUBJECT_PREFIX = "[troggle]"
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
@ -165,12 +170,10 @@ LOGFILE = os.fspath(LOGFILE)
SURVEYS = os.fspath(SURVEYS)
EXPOWEB = os.fspath(EXPOWEB)
THREEDCACHEDIR = os.fspath(THREEDCACHEDIR)
DRAWINGS_DATA = os.fspath(DRAWINGS_DATA)
DRAWINGS_DATA = os.fspath(DRAWINGS_DATA)
SURVEX_DATA = os.fspath(SURVEX_DATA)
REPOS_ROOT_PATH = os.fspath(REPOS_ROOT_PATH)
TEMPLATE_PATH = os.fspath(TROGGLE_PATH)
MEDIA_ROOT = os.fspath(MEDIA_ROOT)
JSLIB_ROOT = os.fspath(JSLIB_ROOT)
JSLIB_ROOT = os.fspath(JSLIB_ROOT)
JSLIB_ROOT = os.fspath(JSLIB_ROOT)
SURVEY_SCANS = os.fspath(SURVEY_SCANS)

View File

@ -38,7 +38,7 @@ def pathsreport(request):
"EXPOWEB" : str( settings.EXPOWEB),
"EXPOWEB_URL" : str( settings.EXPOWEB_URL),
"FILES" : str( settings.FILES),
# "LIBDIR" : str( settings.LIBDIR),
"LIBDIR" : str( settings.LIBDIR),
"LOGFILE" : str( settings.LOGFILE),
"LOGIN_REDIRECT_URL" : str( settings.LOGIN_REDIRECT_URL),
"MEDIA_ROOT" : str( settings.MEDIA_ROOT),
@ -76,7 +76,7 @@ def pathsreport(request):
"EXPOWEB" : type(settings.EXPOWEB),
"EXPOWEB_URL" : type(settings.EXPOWEB_URL),
"FILES" : type(settings.FILES),
# "LIBDIR" : type( settings.LIBDIR),
"LIBDIR" : type( settings.LIBDIR),
"LOGFILE" : type(settings.LOGFILE),
"LOGIN_REDIRECT_URL" : type(settings.LOGIN_REDIRECT_URL),
"MEDIA_ROOT" : type(settings.MEDIA_ROOT),

View File

@ -40,5 +40,9 @@
</table>
<p>
There are {{ ncodes }} different path codes defined.
<p>This report is generated from <code>templates/pathsreport.html</code> and
by <code>pathsreport(request)</code> in <code>core/views/statistics.py </code>
<hr>
<p>Go to <a href="/handbook/troggle/trogmanual.html">Troggle maintenance manuals</a>
{% endblock %}