2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-28 18:46:39 +00:00

Trim print statements from settings to clean up logs

This commit is contained in:
2026-02-09 13:14:23 +00:00
parent 1a2dab89c9
commit 03e1f61a9f
3 changed files with 43 additions and 40 deletions

View File

@@ -33,11 +33,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"
# -----------------------------------------------------------------
# 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 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 #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 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 # 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_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 #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 LOGFILE = '/var/log/troggle/troggle.log'
IMPORTLOGFILE = '/var/log/troggle/import.log' # hmm. Not used since 2022 IMPORTLOGFILE = '/var/log/troggle/import.log'
# Sanitise these to be strings as Django seems to be particularly sensitive to crashing if they aren't # Sanitise these to be strings as Django seems to be particularly sensitive to crashing if they aren't
STATIC_URL = str(STATIC_URL) + "/" #STATIC_URL = str(STATIC_URL) + "/"
MEDIA_URL = str(MEDIA_URL) + "/" #MEDIA_URL = str(MEDIA_URL) + "/"
print(" + finished importing troggle/localsettings.py") print(" + finished importing troggle/localsettings.py")

View File

@@ -1,6 +1,4 @@
import os
import sys import sys
import urllib.parse
from pathlib import Path from pathlib import Path
"""Settings for a troggle installation which may vary among different """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 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 <django-test@klebos.eu>"
# -----------------------------------------------------------------
# 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 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 #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'. 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
"OPTIONS": { "OPTIONS": {
"charset": "utf8mb4", # To permit emojis in logbook entries and elsewhere "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. '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. 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
'PORT' : '', # Set to empty string for default. 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/' REPOS_ROOT_PATH = '/home/expo/'
sys.path.append(REPOS_ROOT_PATH) sys.path.append(REPOS_ROOT_PATH)
@@ -141,24 +148,32 @@ SCANS_ROOT = EXPOFILES / "surveyscans"
PHOTOS_ROOT = EXPOFILES / "photos" PHOTOS_ROOT = EXPOFILES / "photos"
#EXPOFILES = urllib.parse.urljoin(REPOS_ROOT_PATH, 'expofiles/') #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 is used by urls.py in a regex. See urls.py & core/views_surveys.py
MEDIA_URL = '/site_media/' MEDIA_URL = '/site_media/'
STATIC_URL = urllib.parse.urljoin(URL_ROOT , '/static/') # used by Django admin pages. Do not delete. STATIC_URL = Path(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 ? 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 # 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_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 #TINY_MCE_MEDIA_URL = STATIC_URL + '/tiny_mce/' # not needed while TinyMCE not installed
LOGFILE = '/var/log/troggle/troggle.log' LOGFILE = '/var/log/troggle/troggle.log' # hmm. Not used since 2022
IMPORTLOGFILE = '/var/log/troggle/import.log' 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 # Sanitise these to be strings as Django seems to be particularly sensitive to crashing if they aren't
#STATIC_URL = str(STATIC_URL) + "/" STATIC_URL = str(STATIC_URL) + "/"
#MEDIA_URL = str(MEDIA_URL) + "/" MEDIA_URL = str(MEDIA_URL) + "/"
print(" + finished importing troggle/localsettings.py") # print(" + finished importing troggle/localsettings.py")

View File

@@ -12,9 +12,9 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/ 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 HOSTNAME = gethostname() # "expo" on expo.survex.com
print(f">>>>running on {HOSTNAME}<<<<") # print(f">>>>running on {HOSTNAME}<<<<")
if HOSTNAME == "expo": if HOSTNAME == "expo":
# print(">>>>running on expo.survex.com<<<<") # print(">>>>running on expo.survex.com<<<<")
DEVSERVER = False DEVSERVER = False
@@ -149,6 +149,6 @@ QM_PATTERN = r"\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]"
TEST_RUNNER = "django.test.runner.DiscoverRunner" 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 * from localsettings import *
# localsettings needs to take precedence. Call it to override any existing vars. # localsettings needs to take precedence. Call it to override any existing vars.