summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--flatpages/views.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/flatpages/views.py b/flatpages/views.py
index 3dcb490..518b157 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -66,8 +66,9 @@ def flatpage(request, path):
return render(request, 'pagenotfound.html', {'path': path})
else:
try:
- #print(" - FLATPAGES the file: {} ...".format(path))
- if path.startswith("site_media"):
+ #print(" - FLATPAGES the file: '{}' ...".format(path))
+ #print(" - FLATPAGES MEDIA_ROOT: '{}' ...".format(settings.MEDIA_ROOT))
+ if path.startswith('site_media'):
#print(" - MEDIA_ROOT: {} ...".format(settings.MEDIA_ROOT))
path = path.replace("site_media", settings.MEDIA_ROOT)
filetobeopened = os.path.normpath(path)
@@ -76,7 +77,9 @@ def flatpage(request, path):
path = path.replace("static", settings.MEDIA_ROOT)
filetobeopened = os.path.normpath(path)
else:
+ #print(" - NO _ROOT: {} ...".format(settings.EXPOWEB))
filetobeopened = os.path.normpath(settings.EXPOWEB + path)
+
#print(" - FLATPAGES full path : {} ...".format(filetobeopened))
o = open(filetobeopened, "rb")
#print(" - FLATPAGES full path no error: {} ...".format(filetobeopened))
@@ -121,13 +124,16 @@ def flatpage(request, path):
def getmimetype(path):
if path.lower().endswith(".css"): return "text/css"
+ if path.lower().endswith(".txt"): return "text/css"
if path.lower().endswith(".js"): return "application/javascript"
+ if path.lower().endswith(".json"): return "application/javascript"
if path.lower().endswith(".png"): return "image/png"
if path.lower().endswith(".tif"): return "image/tif"
if path.lower().endswith(".gif"): return "image/gif"
if path.lower().endswith(".jpeg"): return "image/jpeg"
if path.lower().endswith(".jpg"): return "image/jpeg"
if path.lower().endswith("svg"): return "image/svg+xml"
+ if path.lower().endswith("xml"): return "image/xml"
if path.lower().endswith(".pdf"): return "application/pdf"
if path.lower().endswith(".ps"): return "application/postscript"
if path.lower().endswith(".svx"): return "application/x-survex-svx"