new remote expofiles option

This commit is contained in:
Philip Sargent 2021-03-26 13:51:00 +00:00
parent 2e068d3fbb
commit f5e799d632
3 changed files with 22 additions and 13 deletions

View File

@ -139,8 +139,6 @@ class PageTests(TestCase):
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):

View File

@ -26,7 +26,9 @@ print(" * importing troggle/localsettings.py")
#-----------------------------------------------------------------
SERVERPORT = '8000'
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
# --------------------- MEDIA redirections BEGIN ---------------------
#REPOS_ROOT_PATH = '/mnt/d/CUCC-Expo/t37/'
REPOS_ROOT_PATH = Path(__file__).parent.parent
@ -65,8 +67,8 @@ PUBLIC_SITE = True
DEBUG = True # Always keep this True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES !
# executables:
CAVERN = 'cavern'
SURVEXPORT = 'survexport'
CAVERN = 'cavern' # for parsing .svx files and producing .3d files
SURVEXPORT = 'survexport' # for parsing .3d files and producing .pos files
DATABASES = {
'default': {
@ -141,7 +143,7 @@ SURVEYS_URL = '/survey_scans/'
EXPOFILES ='/mnt/f/expofiles/'
# Sanitise these to be strings as all other code is expecting strings
# and we have not made the chnage to pathlib Path type in the other localsettings-* variants yet.
# and we have not made the change to pathlib Path type in the other localsettings-* variants yet.
CAVEDESCRIPTIONS = os.fspath(CAVEDESCRIPTIONS)
ENTRANCEDESCRIPTIONS = os.fspath(ENTRANCEDESCRIPTIONS)
LOGFILE = os.fspath(LOGFILE)

25
urls.py
View File

@ -31,12 +31,28 @@ The API urls return TSV or JSON and are new in July 2020.
# not yet restored all the functions. Some may have never been fully implemented in
# the first place and what they were intended to provide is obscure.
if settings.EXPOFILESREMOTE:
expofilesurls = [
url(r'^(?P<path>.*)$', flatviews.expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles
]
else:
expofilesurls = [
url(r'^(?P<filepath>.*)$',view_surveys.expofilessingle, name="single"), # local copy of EXPOFILES
]
actualurlpatterns = [
url(r'^expofiles/', include(expofilesurls)),
url(r'^troggle$', views_other.frontpage, name="frontpage"),
url(r'^caves$', views_caves.caveindex, name="caveindex"),
url(r'^indxal.htm$', views_caves.caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files
url(r'^people/?$', views_logbooks.personindex, name="personindex"),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('registration.backends.default.urls')), #LOGIN_URL = '/accounts/login/' # default
url(r'^newqmnumber/?$', views_other.ajax_QM_number, ),
# url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #broken, removed.
# url(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
@ -90,10 +106,6 @@ actualurlpatterns = [
url(r'^cave/(?P<cave_id>[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"),
url(r'^downloadqms$', views_other.downloadQMs),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('registration.backends.default.urls')), #LOGIN_URL = '/accounts/login/' # default
# url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then.
# url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map
@ -121,10 +133,7 @@ actualurlpatterns = [
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
# use this next alternative if no local copy of expofiles.
url(r'^expofiles/(?P<path>.*)$', flatviews.expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles
url(r'^expofiles/(?P<filepath>.*)$',view_surveys.expofilessingle, name="single"), # local copy of EXPOFILES
# url(r'^javascript/(?P<filepath>.*)$', view_surveys.cssfilessingle, name="single"), # JSLIB_URL - Apache: Alias /javascript /usr/share/javascript
# static views not working, removed as a plugin. Use apache instead to serve these: