forked from expo/troggle
LIBDIR automatically gets right python version
This commit is contained in:
parent
2c13c1b5f3
commit
7f542b8936
@ -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
|
This file is included at the end of the main troggle/settings.py file so that
|
||||||
it overwrites defaults in that file.
|
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/
|
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
|
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 ---------------------
|
# --------------------- MEDIA redirections BEGIN ---------------------
|
||||||
#REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/t37/'
|
REPOS_ROOT_PATH = Path(__file__).parent.parent
|
||||||
REPOS_ROOT_PATH = Path(__file__).parent.parent # We are assuming all 4 repos are siblings.
|
LIBDIR = REPOS_ROOT_PATH / 'lib' / PV
|
||||||
version = sys.version_info
|
#LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python3.7' # should be finding this automatically: python --version etc.
|
||||||
#LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python{}.{}'.format(version.major, version.minor) # eg python 3.7
|
|
||||||
|
|
||||||
TROGGLE_PATH = Path(__file__).parent
|
TROGGLE_PATH = Path(__file__).parent
|
||||||
TEMPLATE_PATH = TROGGLE_PATH / 'templates'
|
TEMPLATE_PATH = TROGGLE_PATH / 'templates'
|
||||||
MEDIA_ROOT = TROGGLE_PATH / 'media'
|
MEDIA_ROOT = TROGGLE_PATH / 'media'
|
||||||
JSLIB_ROOT = TROGGLE_PATH / 'media' / 'jslib' # used for CaveViewer JS utility
|
JSLIB_ROOT = TROGGLE_PATH / 'media' / 'jslib' # used for CaveViewer JS utility
|
||||||
|
|
||||||
FILES = Path('/mnt/c/EXPO/expofiles/')
|
FILES = Path('/mnt/f/expofiles/')
|
||||||
EXPOFILES = Path('/mnt/c/EXPO/expofiles/')
|
EXPOFILES = Path('/mnt/f/expofiles/')
|
||||||
SURVEY_SCANS = EXPOFILES / 'surveyscans'
|
SURVEY_SCANS = EXPOFILES / 'surveyscans'
|
||||||
PHOTOS_ROOT = EXPOFILES / 'photos'
|
PHOTOS_ROOT = EXPOFILES / 'photos'
|
||||||
|
|
||||||
@ -117,7 +123,7 @@ TEMPLATES = [
|
|||||||
'django.template.context_processors.debug',
|
'django.template.context_processors.debug',
|
||||||
'django.template.context_processors.i18n',
|
'django.template.context_processors.i18n',
|
||||||
'django.template.context_processors.media', # includes a variable MEDIA_URL
|
'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.tz',
|
||||||
'django.template.context_processors.request', # must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin navigation sidebar.
|
'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',
|
'django.contrib.messages.context_processors.messages',
|
||||||
@ -144,7 +150,6 @@ EMAIL_HOST_USER = "django-test@klebos.net" # Philip Sargent really
|
|||||||
EMAIL_PORT=587
|
EMAIL_PORT=587
|
||||||
EMAIL_USE_TLS = True
|
EMAIL_USE_TLS = True
|
||||||
DEFAULT_FROM_EMAIL = 'django-test@klebos.net'
|
DEFAULT_FROM_EMAIL = 'django-test@klebos.net'
|
||||||
EMAIL_SUBJECT_PREFIX = "[troggle]"
|
|
||||||
|
|
||||||
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
|
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
|
||||||
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
|
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
|
||||||
@ -165,12 +170,10 @@ LOGFILE = os.fspath(LOGFILE)
|
|||||||
SURVEYS = os.fspath(SURVEYS)
|
SURVEYS = os.fspath(SURVEYS)
|
||||||
EXPOWEB = os.fspath(EXPOWEB)
|
EXPOWEB = os.fspath(EXPOWEB)
|
||||||
THREEDCACHEDIR = os.fspath(THREEDCACHEDIR)
|
THREEDCACHEDIR = os.fspath(THREEDCACHEDIR)
|
||||||
DRAWINGS_DATA = os.fspath(DRAWINGS_DATA)
|
DRAWINGS_DATA = os.fspath(DRAWINGS_DATA)
|
||||||
SURVEX_DATA = os.fspath(SURVEX_DATA)
|
SURVEX_DATA = os.fspath(SURVEX_DATA)
|
||||||
REPOS_ROOT_PATH = os.fspath(REPOS_ROOT_PATH)
|
REPOS_ROOT_PATH = os.fspath(REPOS_ROOT_PATH)
|
||||||
TEMPLATE_PATH = os.fspath(TROGGLE_PATH)
|
TEMPLATE_PATH = os.fspath(TROGGLE_PATH)
|
||||||
MEDIA_ROOT = os.fspath(MEDIA_ROOT)
|
MEDIA_ROOT = os.fspath(MEDIA_ROOT)
|
||||||
JSLIB_ROOT = os.fspath(JSLIB_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)
|
SURVEY_SCANS = os.fspath(SURVEY_SCANS)
|
||||||
|
@ -38,7 +38,7 @@ def pathsreport(request):
|
|||||||
"EXPOWEB" : str( settings.EXPOWEB),
|
"EXPOWEB" : str( settings.EXPOWEB),
|
||||||
"EXPOWEB_URL" : str( settings.EXPOWEB_URL),
|
"EXPOWEB_URL" : str( settings.EXPOWEB_URL),
|
||||||
"FILES" : str( settings.FILES),
|
"FILES" : str( settings.FILES),
|
||||||
# "LIBDIR" : str( settings.LIBDIR),
|
"LIBDIR" : str( settings.LIBDIR),
|
||||||
"LOGFILE" : str( settings.LOGFILE),
|
"LOGFILE" : str( settings.LOGFILE),
|
||||||
"LOGIN_REDIRECT_URL" : str( settings.LOGIN_REDIRECT_URL),
|
"LOGIN_REDIRECT_URL" : str( settings.LOGIN_REDIRECT_URL),
|
||||||
"MEDIA_ROOT" : str( settings.MEDIA_ROOT),
|
"MEDIA_ROOT" : str( settings.MEDIA_ROOT),
|
||||||
@ -76,7 +76,7 @@ def pathsreport(request):
|
|||||||
"EXPOWEB" : type(settings.EXPOWEB),
|
"EXPOWEB" : type(settings.EXPOWEB),
|
||||||
"EXPOWEB_URL" : type(settings.EXPOWEB_URL),
|
"EXPOWEB_URL" : type(settings.EXPOWEB_URL),
|
||||||
"FILES" : type(settings.FILES),
|
"FILES" : type(settings.FILES),
|
||||||
# "LIBDIR" : type( settings.LIBDIR),
|
"LIBDIR" : type( settings.LIBDIR),
|
||||||
"LOGFILE" : type(settings.LOGFILE),
|
"LOGFILE" : type(settings.LOGFILE),
|
||||||
"LOGIN_REDIRECT_URL" : type(settings.LOGIN_REDIRECT_URL),
|
"LOGIN_REDIRECT_URL" : type(settings.LOGIN_REDIRECT_URL),
|
||||||
"MEDIA_ROOT" : type(settings.MEDIA_ROOT),
|
"MEDIA_ROOT" : type(settings.MEDIA_ROOT),
|
||||||
|
@ -40,5 +40,9 @@
|
|||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
There are {{ ncodes }} different path codes defined.
|
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 %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user