summaryrefslogtreecommitdiffstats
path: root/_deploy/wsl/localsettingsWSL.py
diff options
context:
space:
mode:
Diffstat (limited to '_deploy/wsl/localsettingsWSL.py')
-rw-r--r--_deploy/wsl/localsettingsWSL.py160
1 files changed, 78 insertions, 82 deletions
diff --git a/_deploy/wsl/localsettingsWSL.py b/_deploy/wsl/localsettingsWSL.py
index 79d9026..7998996 100644
--- a/_deploy/wsl/localsettingsWSL.py
+++ b/_deploy/wsl/localsettingsWSL.py
@@ -1,6 +1,4 @@
-import os
import sys
-import urllib.parse
from pathlib import Path
"""Settings for a troggle installation which may vary among different
@@ -22,11 +20,11 @@ Read https://adamj.eu/tech/2020/03/16/use-pathlib-in-your-django-project/
print(" * importing troggle/localsettings.py")
-#-----------------------------------------------------------------
+# -----------------------------------------------------------------
# THINK before you push this to a repo
# - have you checked that credentials.py is in .gitignore ?
# - we don't want to have to change the expo system password !
-#-----------------------------------------------------------------
+# -----------------------------------------------------------------
# default values, real secrets imported from credentials.py
SECRET_KEY = "real-SECRET_KEY--imported-from-localsettings.py"
@@ -34,10 +32,10 @@ EXPOUSERPASS = "nnn:gggggg - real-expo-password---imported-from-localsettings.py
EXPOADMINUSERPASS = "gggggg:nnn - real-expo-password---imported-from-localsettings.py"
EMAIL_HOST_PASSWORD = "real-email-password---imported-from-localsettings.py"
-EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever. Tests are then less accurate.
-#SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely
+EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever. Tests are then less accurate.
+# SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely
-SERVERPORT = '8000' # not needed
+SERVERPORT = "8000" # not needed
PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
@@ -45,70 +43,70 @@ PV = "python" + str(sys.version_info.major) + "." + str(sys.version_info.minor)
# so we use pathlib which has been standard since python 3.4
# If pathlib is new to you, you will need to read https://realpython.com/python-pathlib/
-# --------------------- MEDIA redirections BEGIN ---------------------
+# --------------------- MEDIA redirections BEGIN ---------------------
REPOS_ROOT_PATH = Path(__file__).parent.parent
-LIBDIR = REPOS_ROOT_PATH / 'lib' / PV
-#LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python3.9'
+LIBDIR = REPOS_ROOT_PATH / "lib" / PV
+# LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python3.9'
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
+TEMPLATE_PATH = TROGGLE_PATH / "templates"
+MEDIA_ROOT = TROGGLE_PATH / "media"
+JSLIB_ROOT = TROGGLE_PATH / "media" / "jslib" # used for CaveViewer JS utility
-#FILES = Path('/mnt/d/expofiles/')
+# FILES = Path('/mnt/d/expofiles/')
EXPOFILES = REPOS_ROOT_PATH / "expofiles"
-SCANS_ROOT = EXPOFILES / 'surveyscans'
-PHOTOS_ROOT = EXPOFILES / 'photos'
+SCANS_ROOT = EXPOFILES / "surveyscans"
+PHOTOS_ROOT = EXPOFILES / "photos"
PHOTOS_YEAR = "2022"
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
-MEDIA_URL = '/site-media/'
+MEDIA_URL = "/site-media/"
-DIR_ROOT = Path('') #this should end in / if a value is given
-URL_ROOT = '/'
+DIR_ROOT = Path("") # this should end in / if a value is given
+URL_ROOT = "/"
# URL_ROOT = 'http://localhost:'+ SERVERPORT +'/'
-#Note that these constants are not actually used in urls.py, they should be..
+# Note that these constants are not actually used in urls.py, they should be..
# and they all need to end with / so using 'Path' doesn't work..
-MEDIA_URL = Path(URL_ROOT , '/site_media/')
-PHOTOS_URL = Path(URL_ROOT , '/photos/')
+MEDIA_URL = Path(URL_ROOT, "/site_media/")
+PHOTOS_URL = Path(URL_ROOT, "/photos/")
-STATIC_URL = Path(URL_ROOT , '/static/') # used by Django admin pages. Do not delete.
-JSLIB_URL = Path(URL_ROOT , '/javascript/') # used for CaveViewer JS utility
+STATIC_URL = Path(URL_ROOT, "/static/") # used by Django admin pages. Do not delete.
+JSLIB_URL = Path(URL_ROOT, "/javascript/") # used for CaveViewer JS utility
-#STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
-# --------------------- MEDIA redirections END ---------------------
+# STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
+# --------------------- MEDIA redirections END ---------------------
PUBLIC_SITE = True
-DEBUG = True # Always keep this True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES !
+DEBUG = True # Always keep this True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES !
CACHEDPAGES = True # experimental page cache for a handful of page types
# executables:
-CAVERN = 'cavern' # for parsing .svx files and producing .3d files
-SURVEXPORT = 'survexport' # for parsing .3d files and producing .pos files
+CAVERN = "cavern" # for parsing .svx files and producing .3d files
+SURVEXPORT = "survexport" # for parsing .3d files and producing .pos files
DBSQLITE = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME' : '/home/philip/p11d5/troggle.sqlite',
-# 'NAME' : ':memory:',
- 'USER' : 'expo', # Not used with sqlite3.
- 'PASSWORD' : 'sekrit', # Not used with sqlite3.
- 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
- 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ "NAME": "/home/philip/p11d5/troggle.sqlite",
+ # 'NAME' : ':memory:',
+ "USER": "expo", # Not used with sqlite3.
+ "PASSWORD": "sekrit", # Not used with sqlite3.
+ "HOST": "", # Set to empty string for localhost. Not used with sqlite3.
+ "PORT": "", # Set to empty string for default. Not used with sqlite3.
}
}
DBMARIADB = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME' : 'troggle', # Or path to database file if using sqlite3.
- 'USER' : 'expo',
- 'PASSWORD' : 'my-secret-password-schwatzmooskogel',
- 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
- 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
+ "default": {
+ "ENGINE": "django.db.backends.mysql", # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ "NAME": "troggle", # Or path to database file if using sqlite3.
+ "USER": "expo",
+ "PASSWORD": "my-secret-password-schwatzmooskogel",
+ "HOST": "", # Set to empty string for localhost. Not used with sqlite3.
+ "PORT": "", # Set to empty string for default. Not used with sqlite3.
}
}
@@ -120,59 +118,57 @@ if DBSWITCH == "sqlite":
if DBSWITCH == "mariadb":
DATABASES = DBMARIADB
-NOTABLECAVESHREFS = [ "290", "291", "359", "264", "258", "204", "76", "107"]
+NOTABLECAVESHREFS = ["290", "291", "359", "264", "258", "204", "76", "107"]
-PYTHON_PATH = REPOS_ROOT_PATH / 'troggle'
+PYTHON_PATH = REPOS_ROOT_PATH / "troggle"
-LOGFILE = PYTHON_PATH / 'troggle.log'
+LOGFILE = PYTHON_PATH / "troggle.log"
TEMPLATES = [
{
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [
- TEMPLATE_PATH
- ],
- 'OPTIONS': {
- 'debug': 'DEBUG',
- 'context_processors': [
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ "DIRS": [TEMPLATE_PATH],
+ "OPTIONS": {
+ "debug": "DEBUG",
+ "context_processors": [
# django.template.context_processors.csrf, # is always enabled and cannot be removed, sets csrf_token
- 'django.contrib.auth.context_processors.auth', # knowledge of logged-on user & permissions
- 'core.context.troggle_context', # in core/troggle.py - only used in expedition.html
- '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 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',
+ "django.contrib.auth.context_processors.auth", # knowledge of logged-on user & permissions
+ "core.context.troggle_context", # in core/troggle.py - only used in expedition.html
+ "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 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",
],
- 'loaders': [
- 'django.template.loaders.filesystem.Loader', # default lcation is troggle/templates/
- 'django.template.loaders.app_directories.Loader', # needed for admin 'app'
- ]
- },
+ "loaders": [
+ "django.template.loaders.filesystem.Loader", # default lcation is troggle/templates/
+ "django.template.loaders.app_directories.Loader", # needed for admin 'app'
+ ],
+ },
},
]
-EXPOUSER = 'expo'
-EXPOUSER_EMAIL = 'philip.sargent@gmail.com'
-EXPOADMINUSER = 'expoadmin'
-EXPOADMINUSER_EMAIL = 'philip.sargent@gmail.com'
+EXPOUSER = "expo"
+EXPOUSER_EMAIL = "philip.sargent@gmail.com"
+EXPOADMINUSER = "expoadmin"
+EXPOADMINUSER_EMAIL = "philip.sargent@gmail.com"
EMAIL_HOST = "smtp-auth.mythic-beasts.com"
-EMAIL_HOST_USER = "django-test@klebos.net" # Philip Sargent really
-EMAIL_PORT=587
+EMAIL_HOST_USER = "django-test@klebos.net" # Philip Sargent really
+EMAIL_PORT = 587
EMAIL_USE_TLS = True
-DEFAULT_FROM_EMAIL = 'django-test@klebos.net'
+DEFAULT_FROM_EMAIL = "django-test@klebos.net"
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
DRAWINGS_DATA = REPOS_ROOT_PATH / "drawings"
-EXPOWEB = REPOS_ROOT_PATH / "expoweb"
+EXPOWEB = REPOS_ROOT_PATH / "expoweb"
-CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
-ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
-EXPOWEB_URL = ''
+CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
+ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
+EXPOWEB_URL = ""
# SCANS_URL = '/survey_scans/' # defunct, removed.
# Sanitise these to be strings as all other code is expecting strings
@@ -189,9 +185,9 @@ EXPOWEB_URL = ''
# SCANS_ROOT = str(SCANS_ROOT)
# EXPOFILES = str(EXPOFILES)
# PHOTOS_ROOT = str(PHOTOS_ROOT)
-STATIC_URL = str(STATIC_URL) +"/"
-MEDIA_URL = str(MEDIA_URL) +"/"
+STATIC_URL = str(STATIC_URL) + "/"
+MEDIA_URL = str(MEDIA_URL) + "/"
# PYTHON_PATH = str(PYTHON_PATH)
# REPOS_ROOT_PATH = str(REPOS_ROOT_PATH)
sys.path.append(str(REPOS_ROOT_PATH))
-sys.path.append(str(PYTHON_PATH)) \ No newline at end of file
+sys.path.append(str(PYTHON_PATH))