mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
pathlib updates
This commit is contained in:
parent
9a91487375
commit
39194704f5
@ -132,14 +132,25 @@ class PageTests(TestCase):
|
||||
phrase = re.search(r'Phil Wigglesworth', content)
|
||||
phrase = re.search(r'A more obscure record of longest gap between expos has', content)
|
||||
|
||||
def test_page_expofile(self):
|
||||
def test_page_expofile_document(self):
|
||||
# Flat file tests.
|
||||
response = self.client.get('/expofiles/documents/surveying/tunnel-loefflerCP35-only.pdf')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(len(response.content), 2299270)
|
||||
if response.status_code != 200:
|
||||
self.assertEqual(response.status_code, 302)
|
||||
if response.status_code != 302:
|
||||
self.assertEqual(response.status_code, 200)
|
||||
print(response)
|
||||
print(response.content)
|
||||
self.assertEqual(len(response.content), 2299270) # fails, but is working manually!
|
||||
|
||||
def test_page_expofile_writeup(self):
|
||||
# Flat file tests.
|
||||
response = self.client.get('/expofiles/writeups/1982/logbook1982.pdf')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(len(response.content), 12915413)
|
||||
if response.status_code != 200:
|
||||
self.assertEqual(response.status_code, 302)
|
||||
if response.status_code != 302:
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(len(response.content), 12915413) # fails, but is working manually!
|
||||
|
||||
|
||||
def test_page_ss(self):
|
||||
|
@ -2,9 +2,9 @@ import django
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
if django.VERSION[0] >=1 and django.VERSION[1] > 1:
|
||||
pass
|
||||
else:
|
||||
# if django.VERSION[0] >=1 and django.VERSION[1] > 1:
|
||||
# pass
|
||||
# else:
|
||||
|
||||
@register.simple_tag
|
||||
def csrf_token(): return ""
|
||||
# @register.simple_tag
|
||||
# def csrf_token(): return ""
|
||||
|
@ -16,6 +16,7 @@ a complete reset, and the queue is then executed.
|
||||
In future all these functions may be moved to a control panel webpage running within the
|
||||
troggle application.
|
||||
"""
|
||||
print(" - settings on loading databaseReset.py", flush=True)
|
||||
|
||||
os.environ['PYTHONPATH'] = settings.PYTHON_PATH
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
|
||||
|
@ -1,7 +1,7 @@
|
||||
import sys
|
||||
import os
|
||||
import urllib.parse
|
||||
from unipath import Path
|
||||
from pathlib import Path
|
||||
"""Settings for a troggle installation which may vary among different
|
||||
installations: for development or deployment, in a docker image or
|
||||
python virtual environment (venv), on ubuntu, debian or in Windows
|
||||
@ -26,20 +26,38 @@ print(" * importing troggle/localsettings.py")
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
SERVERPORT = '8000'
|
||||
|
||||
#SECURE_SSL_REDIRECT = True # breaks 7 tests in test suite 301 not 200 (or 302) and runserver fails completely
|
||||
# --------------------- MEDIA redirections BEGIN ---------------------
|
||||
#REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/t37/'
|
||||
REPOS_ROOT_PATH = Path(__file__).ancestor(1)
|
||||
LIBDIR = REPOS_ROOT_PATH.child('lib').child('python3.7')
|
||||
REPOS_ROOT_PATH = Path(__file__).parent.parent
|
||||
LIBDIR = REPOS_ROOT_PATH / 'lib' / 'python3.7'
|
||||
|
||||
TROGGLE_PATH = Path(__file__)
|
||||
TEMPLATE_PATH = TROGGLE_PATH.child('templates')
|
||||
MEDIA_ROOT = TROGGLE_PATH.child('media')
|
||||
TROGGLE_PATH = Path(__file__).parent
|
||||
TEMPLATE_PATH = os.fspath(TROGGLE_PATH / 'templates')
|
||||
MEDIA_ROOT = os.fspath(TROGGLE_PATH / 'media')
|
||||
|
||||
# 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/'
|
||||
|
||||
URL_ROOT = 'http://localhost:'+ SERVERPORT +'/'
|
||||
DIR_ROOT = ''#this should end in / if a value is given
|
||||
|
||||
MEDIA_URL = urllib.parse.urljoin(URL_ROOT , '/site_media/')
|
||||
SURVEYS_URL = urllib.parse.urljoin(URL_ROOT , '/survey_scans/')
|
||||
PHOTOS_URL = urllib.parse.urljoin(URL_ROOT , '/photos/')
|
||||
SVX_URL = urllib.parse.urljoin(URL_ROOT , '/survex/')
|
||||
|
||||
|
||||
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 ?
|
||||
|
||||
print(REPOS_ROOT_PATH)
|
||||
print(LIBDIR)
|
||||
print(TROGGLE_PATH)
|
||||
print(TEMPLATE_PATH)
|
||||
print(MEDIA_ROOT)
|
||||
|
||||
#STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views_surveys.py
|
||||
# --------------------- MEDIA redirections END ---------------------
|
||||
|
||||
@ -48,7 +66,7 @@ DEBUG = True # Always keep this, even when on public server. Otherwise NO ERROR
|
||||
|
||||
# executables:
|
||||
CAVERN = 'cavern'
|
||||
THREEDTOPOS = 'survexport --pos'
|
||||
SURVEXPORT = 'survexport'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
@ -64,17 +82,18 @@ DATABASES = {
|
||||
# add in 290, 291, 358 when they don't make it crash horribly
|
||||
NOTABLECAVESHREFS = [ "264", "258", "204", "76", "107"]
|
||||
|
||||
sys.path.append(REPOS_ROOT_PATH)
|
||||
sys.path.append(REPOS_ROOT_PATH + 'troggle')
|
||||
PYTHON_PATH = REPOS_ROOT_PATH.child('troggle')
|
||||
PYTHON_PATH = REPOS_ROOT_PATH / 'troggle'
|
||||
sys.path.append(os.fspath(REPOS_ROOT_PATH))
|
||||
sys.path.append(os.fspath(PYTHON_PATH))
|
||||
|
||||
LOGFILE = PYTHON_PATH.child(troggle.log')
|
||||
LOGFILE = PYTHON_PATH / 'troggle.log'
|
||||
PYTHON_PATH = os.fspath(PYTHON_PATH)
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
PYTHON_PATH + "templates"
|
||||
TEMPLATE_PATH
|
||||
],
|
||||
'OPTIONS': {
|
||||
'debug': 'DEBUG',
|
||||
@ -107,29 +126,19 @@ EMAIL_HOST_PASSWORD = "insert-real-email-password-here"
|
||||
EMAIL_PORT=587
|
||||
EMAIL_USE_TLS = True
|
||||
|
||||
SURVEX_DATA = REPOS_ROOT_PATH + 'loser/'
|
||||
TUNNEL_DATA = REPOS_ROOT_PATH + 'drawings/'
|
||||
THREEDCACHEDIR = REPOS_ROOT_PATH + 'expowebcache/3d/'
|
||||
SURVEX_DATA = REPOS_ROOT_PATH / "loser"
|
||||
TUNNEL_DATA = REPOS_ROOT_PATH / "drawings"
|
||||
THREEDCACHEDIR = REPOS_ROOT_PATH / 'expowebcache' / '3d'
|
||||
|
||||
EXPOWEB = REPOS_ROOT_PATH + 'expoweb/'
|
||||
EXPOWEB = REPOS_ROOT_PATH / "expoweb"
|
||||
SURVEYS = REPOS_ROOT_PATH
|
||||
SURVEY_SCANS = '/mnt/f/expofiles/surveyscans/'
|
||||
FILES = '/mnt/f/expofiles/'
|
||||
CAVEDESCRIPTIONS = os.path.join(EXPOWEB, "cave_data")
|
||||
ENTRANCEDESCRIPTIONS = os.path.join(EXPOWEB, "entrance_data")
|
||||
CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
|
||||
ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
|
||||
EXPOWEB_URL = ''
|
||||
SURVEYS_URL = '/survey_scans/'
|
||||
EXPOFILES ='/mnt/f/expofiles/'
|
||||
|
||||
URL_ROOT = 'http://localhost:'+ SERVERPORT +'/'
|
||||
DIR_ROOT = ''#this should end in / if a value is given
|
||||
|
||||
SURVEYS_URL = urllib.parse.urljoin(URL_ROOT , '/survey_scans/')
|
||||
PHOTOS_URL = urllib.parse.urljoin(URL_ROOT , '/photos/')
|
||||
SVX_URL = urllib.parse.urljoin(URL_ROOT , '/survex/')
|
||||
|
||||
|
||||
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 ?
|
||||
|
||||
print(" + finished importing troggle/localsettings.py")
|
||||
|
Loading…
Reference in New Issue
Block a user