diff --git a/_deploy/debian-server/localsettings-expo-live.py b/_deploy/debian-server/localsettings-expo-live.py index b4deafaa..0ed5ff13 100644 --- a/_deploy/debian-server/localsettings-expo-live.py +++ b/_deploy/debian-server/localsettings-expo-live.py @@ -33,11 +33,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" -# ----------------------------------------------------------------- -# THINK before you push this to a repo -# - have you checked that secret_credentials.py is in .gitignore ? -# - we don't want to have to change the expo system password ! -# ----------------------------------------------------------------- EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever #SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely @@ -159,21 +154,14 @@ STATIC_URL = Path(URL_ROOT, "/static/") # used by Django admin pages. Do not de 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 -# Re-enable TinyMCE when Dj upgraded to v3. Also templates/editexpopage.html -# TINYMCE_DEFAULT_CONFIG = { -# 'plugins': "table,spellchecker,paste,searchreplace", -# 'theme': "advanced", -# } -# TINYMCE_SPELLCHECKER = False -# TINYMCE_COMPRESSOR = True #TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' # not needed while TinyMCE not installed #TINY_MCE_MEDIA_URL = STATIC_URL + '/tiny_mce/' # not needed while TinyMCE not installed -LOGFILE = '/var/log/troggle/troggle.log' # hmm. Not used since 2022 -IMPORTLOGFILE = '/var/log/troggle/import.log' # hmm. Not used since 2022 +LOGFILE = '/var/log/troggle/troggle.log' +IMPORTLOGFILE = '/var/log/troggle/import.log' # Sanitise these to be strings as Django seems to be particularly sensitive to crashing if they aren't -STATIC_URL = str(STATIC_URL) + "/" -MEDIA_URL = str(MEDIA_URL) + "/" +#STATIC_URL = str(STATIC_URL) + "/" +#MEDIA_URL = str(MEDIA_URL) + "/" print(" + finished importing troggle/localsettings.py") diff --git a/_deploy/debian-server/localsettings.py b/_deploy/debian-server/localsettings.py index 0e2fe6f4..b9fbae24 100644 --- a/_deploy/debian-server/localsettings.py +++ b/_deploy/debian-server/localsettings.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,9 +20,24 @@ should be eliminated for clarity and to use modern idioms. Edited 31/12/2024 """ -print(" * importing troggle/localsettings.py") +# print(" * importing troggle/localsettings.py") -# DO NOT check this file into the git repo - it contains real passwords. +EXPOUSER = 'expo' +EXPOADMINUSER = 'expoadmin' +EXPOUSER_EMAIL = 'wookey@wookware.org' +EXPOADMINUSER_EMAIL = 'wookey@wookware.org' +from secret_credentials import * + +EMAIL_HOST = "smtp-auth.mythic-beasts.com" +EMAIL_HOST_USER = "django-test@klebos.eu" # Philip Sargent really +EMAIL_PORT = 587 +EMAIL_USE_TLS = True +DEFAULT_FROM_EMAIL = "EXPO SERVER AUTOMATIC " +# ----------------------------------------------------------------- +# THINK before you push this to a repo +# - have you checked that secret_credentials.py is in .gitignore ? +# - we don't want to have to change the expo system password ! +# ----------------------------------------------------------------- EXPOFILESREMOTE = False # if True, then re-routes urls in expofiles to remote sever #SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely @@ -34,22 +47,16 @@ DATABASES = { 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. "OPTIONS": { "charset": "utf8mb4", # To permit emojis in logbook entries and elsewhere - }, - 'NAME' : 'troggle', # Or path to database file if using sqlite3. + }, 'NAME' : 'troggle', # Or path to database file if using sqlite3. 'USER' : 'expo', # Not used with sqlite3. - 'PASSWORD' : 'not-the-real-password', # Not used with sqlite3. + 'PASSWORD' : MARIADB_SERVER_PASSWORD, # 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. } } -EXPOUSER = 'expo' -EXPOUSERPASS = 'not-the-real-password' -EXPOADMINUSER = 'expoadmin' -EXPOADMINUSERPASS = 'not-the-real-password' -EXPOUSER_EMAIL = 'wookey@wookware.org' -EXPOADMINUSER_EMAIL = 'wookey@wookware.org' + REPOS_ROOT_PATH = '/home/expo/' sys.path.append(REPOS_ROOT_PATH) @@ -141,24 +148,32 @@ SCANS_ROOT = EXPOFILES / "surveyscans" PHOTOS_ROOT = EXPOFILES / "photos" #EXPOFILES = urllib.parse.urljoin(REPOS_ROOT_PATH, 'expofiles/') -PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/') +PHOTOS_URL = Path(URL_ROOT, "/photos/") +#PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/') # MEDIA_URL is used by urls.py in a regex. See urls.py & core/views_surveys.py MEDIA_URL = '/site_media/' -STATIC_URL = urllib.parse.urljoin(URL_ROOT , '/static/') # used by Django admin pages. Do not delete. -JSLIB_URL = urllib.parse.urljoin(URL_ROOT , '/javascript/') # always fails, try to revive it ? +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 +# Re-enable TinyMCE when Dj upgraded to v3. Also templates/editexpopage.html +# TINYMCE_DEFAULT_CONFIG = { +# 'plugins': "table,spellchecker,paste,searchreplace", +# 'theme': "advanced", +# } +# TINYMCE_SPELLCHECKER = False +# TINYMCE_COMPRESSOR = True #TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' # not needed while TinyMCE not installed #TINY_MCE_MEDIA_URL = STATIC_URL + '/tiny_mce/' # not needed while TinyMCE not installed -LOGFILE = '/var/log/troggle/troggle.log' -IMPORTLOGFILE = '/var/log/troggle/import.log' +LOGFILE = '/var/log/troggle/troggle.log' # hmm. Not used since 2022 +IMPORTLOGFILE = '/var/log/troggle/import.log' # hmm. Not used since 2022 # Sanitise these to be strings as Django seems to be particularly sensitive to crashing if they aren't -#STATIC_URL = str(STATIC_URL) + "/" -#MEDIA_URL = str(MEDIA_URL) + "/" +STATIC_URL = str(STATIC_URL) + "/" +MEDIA_URL = str(MEDIA_URL) + "/" -print(" + finished importing troggle/localsettings.py") +# print(" + finished importing troggle/localsettings.py") diff --git a/settings.py b/settings.py index ef196f9c..d8ec54be 100644 --- a/settings.py +++ b/settings.py @@ -12,9 +12,9 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ -print("* importing troggle/settings.py") +# print("* importing troggle/settings.py") HOSTNAME = gethostname() # "expo" on expo.survex.com -print(f">>>>running on {HOSTNAME}<<<<") +# print(f">>>>running on {HOSTNAME}<<<<") if HOSTNAME == "expo": # print(">>>>running on expo.survex.com<<<<") DEVSERVER = False @@ -149,6 +149,6 @@ QM_PATTERN = r"\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]" TEST_RUNNER = "django.test.runner.DiscoverRunner" -print("+ finished importing troggle/settings.py, re-importing localsettings again") +# print("+ finished importing troggle/settings.py, re-importing localsettings again") from localsettings import * # localsettings needs to take precedence. Call it to override any existing vars.