summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/TESTS/tests.py10
-rw-r--r--flatpages/views.py7
-rw-r--r--urls.py5
3 files changed, 20 insertions, 2 deletions
diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py
index 8cd1f03..60c6d9c 100644
--- a/core/TESTS/tests.py
+++ b/core/TESTS/tests.py
@@ -74,6 +74,16 @@ class SimpleTest(SimpleTestCase):
from django.http import HttpResponse
from django.urls import reverse
+ def test_import_urls(self):
+ from django.conf import settings
+ from django.conf.urls import url, include
+ from django.views.generic.base import RedirectView
+ from django.views.generic.edit import UpdateView
+ from django.views.generic.list import ListView
+ from django.contrib import admin
+ from django.urls import reverse, resolve
+
+
#class SimplePageTest(unittest.TestCase):
class PageTests(TestCase):
@classmethod
diff --git a/flatpages/views.py b/flatpages/views.py
index 475531f..3dcb490 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -1,7 +1,7 @@
import os
import re
-from django.shortcuts import render
+from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.urls import reverse, resolve
from django.template import Context, loader
@@ -13,6 +13,11 @@ from troggle.core.models_caves import Cave
import troggle.core.views_caves
import troggle.settings as settings
+def expofiles_redirect(request, path):
+ '''This is used only when running as a test system without a local copy of /expofiles/
+ '''
+ return redirect('http://expo.survex.com/expofiles/' + path)
+
def flatpage(request, path):
#print(" - FLATPAGES delivering the file: {} as MIME type: {}".format(path,getmimetype(path)))
# try:
diff --git a/urls.py b/urls.py
index cc72be2..46f1706 100644
--- a/urls.py
+++ b/urls.py
@@ -122,7 +122,10 @@ actualurlpatterns = [
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
- url(r'^expofiles/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # EXPOFILES
+ # 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 - unused
# static views not working, removed as a plugin. Use apache instead to serve these: