mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-21 14:51:51 +00:00
static files redone
This commit is contained in:
parent
bd6490631f
commit
d9c6986a89
31
README.txt
31
README.txt
@ -115,19 +115,19 @@ environment utility
|
||||
|
||||
Patching the django installation
|
||||
--------------------------------
|
||||
Since django 1.7 out of update-support, and since python3 has progressed against
|
||||
the 2015 version that django1.7 is expecting, you need to patch the django
|
||||
Since django 1.10 is out of update-support, and since python3 has progressed against
|
||||
the 2015 version that django is expecting, you need to patch the django
|
||||
installation after installing. In the troggle folder you will find
|
||||
django-patch/html_parser.py
|
||||
copy this over the installed version of django on your machine:
|
||||
|
||||
$ cd troggle
|
||||
$ sudo cp django-patch/html_parser.py /usr/local/lib/python3.8/dist-packages/django/utils/
|
||||
$ sudo cp django-patch/html_parser.py /usr/local/lib/python3.7/dist-packages/django/utils/
|
||||
or
|
||||
$ cp django-patch/html_parser.py ~/.local/lib/python3.8/site-packages/django/utils/
|
||||
$ cp django-patch/html_parser.py ~/.local/lib/python3.7/site-packages/django/utils/
|
||||
if you didn't use sudo when installing everything using pip.
|
||||
|
||||
or if you are using a venv, and you are using python3.7 in it, then
|
||||
or if you are using a venv, then
|
||||
|
||||
$ cd <venv directory>/troggle
|
||||
$ cp django-patch/html_parser.py lib/python3.7/site-packages/django/utils/html_parser.py
|
||||
@ -169,7 +169,7 @@ python manage.py check -v 3 --deploy
|
||||
which will give security warnings for deployment.
|
||||
|
||||
python manage.py check -Wall
|
||||
Goives warnings of deprecated Django which should be fixed asap.
|
||||
Gives warnings of deprecated Django which should be fixed asap.
|
||||
|
||||
Registering troggle as a django application
|
||||
-------------------------------------------
|
||||
@ -201,18 +201,13 @@ then the settings registration of troggle with django is incomplete.
|
||||
Delete all your cached .pyc files and try again.
|
||||
You probably have a mistake in your settings.py or localsettings.py files.
|
||||
|
||||
Django 1.9.13
|
||||
-------------
|
||||
Works fine, but creating a new,clean database does nopt happen automatically
|
||||
when you run databaseReset.py. Instead you have to do this:
|
||||
|
||||
python manage.py makemigrations core
|
||||
python manage.py makemigrations flatpages
|
||||
python manage.py migrate
|
||||
python manage.py migrate core
|
||||
python manage.py migrate flatpages
|
||||
python databaseReset.py reset
|
||||
|
||||
CSS and media files
|
||||
-------------------
|
||||
Temporarily we are not using the STATICFILES capability but are instead
|
||||
serving css files from troggle/media/.. (see urls.py) using
|
||||
view_surveys.cssfilessingle
|
||||
i.e.
|
||||
cssfilessingle() in core/view_surveys.py
|
||||
|
||||
Setting up survex
|
||||
-----------------
|
||||
|
1
categories.json
Normal file
1
categories.json
Normal file
File diff suppressed because one or more lines are too long
1
confusables.json
Normal file
1
confusables.json
Normal file
File diff suppressed because one or more lines are too long
@ -66,7 +66,7 @@ class SimpleTest(SimpleTestCase):
|
||||
from django.db import connection, close_old_connections, connections
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
|
||||
__test__ = {"doctest": """
|
||||
Another way to test that 1 + 1 is equal to 2.
|
||||
|
@ -16,7 +16,8 @@ from django.contrib import admin
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from django.urls import reverse
|
||||
from django.template import Context, loader
|
||||
|
||||
import troggle.core.models_survex
|
||||
|
@ -15,7 +15,7 @@ from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models import Min, Max
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.template import Context, loader
|
||||
|
||||
from troggle.core.models import TroggleModel, Person, Expedition
|
||||
|
@ -4,7 +4,7 @@ import re
|
||||
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
|
||||
|
||||
###########################################################
|
||||
|
@ -12,7 +12,7 @@ def fa_readFile(*path):
|
||||
try:
|
||||
f = open(os.path.join(settings.FILES, *path))
|
||||
except:
|
||||
f = urllib.request.urlopen(settings.FILES + "download/" + reduce(urljoin, path))
|
||||
f = urllib.request.urlopen(settings.FILES+"download/")
|
||||
return f.read()
|
||||
|
||||
def getMimeType(extension):
|
||||
@ -85,6 +85,14 @@ def surveyscansingle(request, path, file):
|
||||
return HttpResponse(content=open(survexscansingle.ffile,"rb"), content_type=getMimeType(path.split(".")[-1]))
|
||||
#return render_to_response('survexscansfolder.html', { 'survexscansfolder':survexscansfolder, 'settings': settings })
|
||||
|
||||
def expofilessingle(request, filepath):
|
||||
fn=urllib.parse.unquote(filepath)
|
||||
return HttpResponse(content=open(settings.EXPOFILES+fn,"rb"))
|
||||
|
||||
def cssfilessingle(request, filepath):
|
||||
fn=urllib.parse.unquote(filepath)
|
||||
return HttpResponse(content=open(settings.MEDIA_ROOT+fn,"rb"),content_type="text/css")
|
||||
|
||||
def surveyscansfolders(request):
|
||||
survexscansfolders = SurvexScansFolder.objects.all()
|
||||
return render_to_response('survexscansfolders.html', { 'survexscansfolders':survexscansfolders, 'settings': settings })
|
||||
|
@ -9,7 +9,7 @@ from PIL import Image, ImageDraw, ImageFont
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
#from django.forms.models import modelformset_factory
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
||||
|
@ -4,7 +4,7 @@ import re
|
||||
|
||||
import django.db.models
|
||||
from django.db.models import Min, Max
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render, render_to_response
|
||||
from django.template import Context, loader
|
||||
@ -185,11 +185,9 @@ def experimental(request):
|
||||
addupsurvexlength = 0
|
||||
for expedition in Expedition.objects.all():
|
||||
survexblocks = expedition.survexblock_set.all()
|
||||
#survexlegs = [ ]
|
||||
legsyear=0
|
||||
survexleglength = 0.0
|
||||
for survexblock in survexblocks:
|
||||
#survexlegs.extend(survexblock.survexleg_set.all())
|
||||
survexleglength += survexblock.totalleglength
|
||||
try:
|
||||
legsyear += int(survexblock.text)
|
||||
@ -199,9 +197,6 @@ def experimental(request):
|
||||
legsbyexpo.append((expedition, {"nsurvexlegs":legsyear, "survexleglength":survexleglength}))
|
||||
legsbyexpo.reverse()
|
||||
|
||||
#removing survexleg objects completely
|
||||
#survexlegs = models.SurvexLeg.objects.all()
|
||||
#totalsurvexlength = sum([survexleg.tape for survexleg in survexlegs])
|
||||
return render(request, 'experimental.html', { "nsurvexlegs":nimportlegs, "totalsurvexlength":totalsurvexlength, "addupsurvexlength":addupsurvexlength, "legsbyexpo":legsbyexpo })
|
||||
|
||||
@login_required_if_public
|
||||
|
@ -2,7 +2,7 @@ import re
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.db.models import Q
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
@ -11,7 +11,6 @@ from django.template import Context, loader
|
||||
import troggle.parsers.imports
|
||||
from troggle.core.models import Expedition, Person, PersonExpedition
|
||||
from troggle.core.models_caves import LogbookEntry, QM, Cave, PersonTrip
|
||||
#from troggle.core.models_survex import SurvexLeg
|
||||
from troggle.helper import login_required_if_public
|
||||
from troggle.core.forms import UploadFileForm
|
||||
|
||||
@ -27,7 +26,6 @@ def frontpage(request):
|
||||
expeditions = Expedition.objects.order_by("-year")
|
||||
logbookentry = LogbookEntry
|
||||
cave = Cave
|
||||
#photo = DPhoto
|
||||
from django.contrib.admin.templatetags import log
|
||||
return render(request,'frontpage.html', locals())
|
||||
|
||||
|
@ -4,8 +4,8 @@ import re
|
||||
|
||||
import django.db.models
|
||||
from django.db.models import Min, Max
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
#from django.urls import reverse, resolve
|
||||
#from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render, render_to_response
|
||||
from django.template import Context, loader
|
||||
from django.template.defaultfilters import slugify
|
||||
@ -22,9 +22,7 @@ from settings import *
|
||||
|
||||
def pathsreport(request):
|
||||
pathsdict={
|
||||
"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX,
|
||||
"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX,
|
||||
"CAVEDESCRIPTIONSX" : CAVEDESCRIPTIONS,
|
||||
"CAVEDESCRIPTIONS" : CAVEDESCRIPTIONS,
|
||||
"DIR_ROOT" : DIR_ROOT,
|
||||
"ENTRANCEDESCRIPTIONS" : ENTRANCEDESCRIPTIONS,
|
||||
"EXPOUSER_EMAIL" : EXPOUSER_EMAIL,
|
||||
@ -36,25 +34,19 @@ def pathsreport(request):
|
||||
"JSLIB_URL" : JSLIB_URL,
|
||||
"LOGFILE" : LOGFILE,
|
||||
"LOGIN_REDIRECT_URL" : LOGIN_REDIRECT_URL,
|
||||
"MEDIA_ADMIN_DIR" : MEDIA_ADMIN_DIR,
|
||||
"MEDIA_ROOT" : MEDIA_ROOT,
|
||||
"MEDIA_URL" : MEDIA_URL,
|
||||
#"PHOTOS_ROOT" : PHOTOS_ROOT,
|
||||
"PHOTOS_URL" : PHOTOS_URL,
|
||||
"PYTHON_PATH" : PYTHON_PATH,
|
||||
"REPOS_ROOT_PATH" : REPOS_ROOT_PATH,
|
||||
"ROOT_URLCONF" : ROOT_URLCONF,
|
||||
"STATIC_ROOT" : STATIC_ROOT,
|
||||
"STATIC_URL" : STATIC_URL,
|
||||
"SURVEX_DATA" : SURVEX_DATA,
|
||||
"SURVEY_SCANS" : SURVEY_SCANS,
|
||||
"SURVEYS" : SURVEYS,
|
||||
"SURVEYS_URL" : SURVEYS_URL,
|
||||
"SVX_URL" : SVX_URL,
|
||||
# "TEMPLATE_DIRS" : TEMPLATE_DIRS,
|
||||
"THREEDCACHEDIR" : THREEDCACHEDIR,
|
||||
# "TINY_MCE_MEDIA_ROOT" : TINY_MCE_MEDIA_ROOT,
|
||||
# "TINY_MCE_MEDIA_URL" : TINY_MCE_MEDIA_URL,
|
||||
"TUNNEL_DATA" : TUNNEL_DATA,
|
||||
"URL_ROOT" : URL_ROOT
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import troggle.core.models_survex
|
||||
from django.core import management
|
||||
from django.db import connection, close_old_connections, connections
|
||||
from django.http import HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from troggle.core.models_caves import Cave, Entrance
|
||||
@ -75,7 +75,7 @@ def reinit_db():
|
||||
print(" - deleting " + currentdbname)
|
||||
os.remove(currentdbname)
|
||||
except OSError:
|
||||
print(" ! OSError on removing: " + currentdbname + " (Is the file open in another app?\n")
|
||||
print(" ! OSError on removing: " + currentdbname + " (Is the file open in another app? Is the server running?\n")
|
||||
raise
|
||||
else:
|
||||
print(" - No database file found: " + currentdbname + " ..continuing, will create it.\n")
|
||||
|
@ -3,12 +3,10 @@ import re
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse, HttpResponseRedirect, Http404
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse, resolve
|
||||
from django.template import Context, loader
|
||||
import django.forms as forms
|
||||
|
||||
#from tinymce.widgets import TinyMCE
|
||||
|
||||
from troggle.helper import login_required_if_public
|
||||
from troggle.flatpages.models import Redirect, EntranceRedirect
|
||||
from troggle.core.models_caves import Cave
|
||||
@ -70,7 +68,7 @@ def flatpage(request, path):
|
||||
if m:
|
||||
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
|
||||
else:
|
||||
return HttpResponse(html + "Page could not be split into header and body")
|
||||
return HttpResponse(html + "Page could not be split into header and body: parsing failed in flatpages.views.py")
|
||||
m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
|
||||
if m:
|
||||
title, = m.groups()
|
||||
@ -89,11 +87,12 @@ def flatpage(request, path):
|
||||
menumatch = re.match(rb'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE)
|
||||
if menumatch:
|
||||
has_menu = True
|
||||
body, = menumatch.groups()
|
||||
#body, = menumatch.groups()
|
||||
# if re.search(rb"iso-8859-1", html):
|
||||
# body = str(body, "iso-8859-1")
|
||||
# body.strip
|
||||
return render(request, 'flatpage.html', {'editable': editable, 'path': path, 'title': title, 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu})
|
||||
return render(request, 'flatpage.html', {'editable': editable, 'path': path, 'title': title,
|
||||
'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu})
|
||||
else:
|
||||
return HttpResponse(o.read(), content_type=getmimetype(path))
|
||||
|
||||
|
@ -10,7 +10,7 @@ from django.core import management
|
||||
from django.db import connection, close_old_connections
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
|
||||
from troggle.core.models_caves import Cave, Entrance
|
||||
import troggle.flatpages.models
|
||||
|
38
media/readme.txt
Normal file
38
media/readme.txt
Normal file
@ -0,0 +1,38 @@
|
||||
Confusions and incompatibilities when migrating to Django 1.10
|
||||
meant conslidating the places we get CSS files and site media such as gifs
|
||||
for page annoations.
|
||||
|
||||
Situation as of 17/6/2020:
|
||||
We have 3 folders for CSS files in 3 very different places:
|
||||
1 in expoweb repo
|
||||
1 in troggle repo
|
||||
1 not in either repo but intimately needed by troggle
|
||||
|
||||
These are (in /home/expo/ ):
|
||||
1. expoweb/css/ (used by the handbook)
|
||||
2. troggle/media/css/ (used by troggle pages)
|
||||
3. static/admin/css (used by django control panel and django plugins)
|
||||
|
||||
1. expoweb/css/ flatviews.flatpage - the url is /css/main2.css
|
||||
2. troggle/media/css/ MEDIA_ROOT, MEDIA_URL - the url is /site_media/css/main3.css
|
||||
3. static/admin/css STATIC_ROOT, STATIC_URL - the url is /static/admin/css/base.css
|
||||
|
||||
After installing Django, weneed to manually copy its CSS etc. files from,
|
||||
e.g. /usr/lib/python3.7/site-packages/django/contrib/admin/static/admin/css
|
||||
to
|
||||
/static/admin/css/base.css
|
||||
if there are changes. But our old set of gifs is probably better.
|
||||
|
||||
from django.contrib.staticfiles import views as staticviews
|
||||
from flatpages import views as flatviews
|
||||
|
||||
1. url(r'^(.*)$', flatviews.flatpage, name="flatpage"),
|
||||
|
||||
2. url(r'^site_media/(?P<path>.*)$', staticviews.serve, {'document_root': settings.MEDIA_ROOT,
|
||||
'show_indexes': True}),
|
||||
3. url(r'^static/(?P<path>.*)$', staticviews.serve, {'document_root': settings.STATIC_ROOT,
|
||||
'show_indexes': True}),
|
||||
|
||||
Also (for development only):
|
||||
url(r'^expofiles/(?P<path>.*)$', staticviews.serve, {'document_root': settings.EXPOFILES,
|
||||
'show_indexes': True}),
|
@ -1,6 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django import http
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.urls import reverse, resolve
|
||||
#from django.core.urlresolvers import resolve
|
||||
|
||||
class SmartAppendSlashMiddleware(object):
|
||||
"""
|
||||
|
@ -6,7 +6,7 @@ from django.core import management
|
||||
from django.db import connection, close_old_connections, connections
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
#from django.urls import reverse, resolve
|
||||
|
||||
import troggle.settings
|
||||
import troggle.parsers.caves
|
||||
|
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
import django
|
||||
|
||||
from .settings import *
|
||||
|
||||
pathsdict={
|
||||
"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX,
|
||||
"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX,
|
||||
"CAVEDESCRIPTIONSX" : CAVEDESCRIPTIONS,
|
||||
"DIR_ROOT" : DIR_ROOT,
|
||||
#"EMAIL_HOST" : EMAIL_HOST,
|
||||
#"EMAIL_HOST_USER" : EMAIL_HOST_USER,
|
||||
"ENTRANCEDESCRIPTIONS" : ENTRANCEDESCRIPTIONS,
|
||||
"EXPOUSER_EMAIL" : EXPOUSER_EMAIL,
|
||||
"EXPOUSERPASS" :"<redacted>",
|
||||
"EXPOUSER" : EXPOUSER,
|
||||
"EXPOWEB" : EXPOWEB,
|
||||
"EXPOWEB_URL" : EXPOWEB_URL,
|
||||
"FILES" : FILES,
|
||||
"JSLIB_URL" : JSLIB_URL,
|
||||
"LOGFILE" : LOGFILE,
|
||||
"LOGIN_REDIRECT_URL" : LOGIN_REDIRECT_URL,
|
||||
"MEDIA_ADMIN_DIR" : MEDIA_ADMIN_DIR,
|
||||
"MEDIA_ROOT" : MEDIA_ROOT,
|
||||
"MEDIA_URL" : MEDIA_URL,
|
||||
#"PHOTOS_ROOT" : PHOTOS_ROOT,
|
||||
"PHOTOS_URL" : PHOTOS_URL,
|
||||
"PYTHON_PATH" : PYTHON_PATH,
|
||||
"REPOS_ROOT_PATH" : REPOS_ROOT_PATH,
|
||||
"ROOT_URLCONF" : ROOT_URLCONF,
|
||||
"STATIC_ROOT" : STATIC_ROOT,
|
||||
"STATIC_URL" : STATIC_URL,
|
||||
"SURVEX_DATA" : SURVEX_DATA,
|
||||
"SURVEY_SCANS" : SURVEY_SCANS,
|
||||
"SURVEYS" : SURVEYS,
|
||||
"SURVEYS_URL" : SURVEYS_URL,
|
||||
"SVX_URL" : SVX_URL,
|
||||
"TEMPLATE_DIRS" : TEMPLATE_DIRS,
|
||||
"THREEDCACHEDIR" : THREEDCACHEDIR,
|
||||
"TINY_MCE_MEDIA_ROOT" : TINY_MCE_MEDIA_ROOT,
|
||||
"TINY_MCE_MEDIA_URL" : TINY_MCE_MEDIA_URL,
|
||||
"TUNNEL_DATA" : TUNNEL_DATA,
|
||||
"URL_ROOT" : URL_ROOT
|
||||
}
|
||||
|
||||
sep="\r\t\t\t" # ugh nasty - terminal output only
|
||||
sep2="\r\t\t\t\t\t\t\t" # ugh nasty - terminal output only
|
||||
|
||||
bycodes = sorted(pathsdict)
|
||||
for p in bycodes:
|
||||
print(p, sep , pathsdict[p])
|
||||
|
||||
byvals = sorted(pathsdict, key=pathsdict.__getitem__)
|
||||
for p in byvals:
|
||||
print(pathsdict[p] , sep2, p)
|
@ -23,6 +23,7 @@ redirect. If you don't use that name, remember to explicitly pass
|
||||
"""
|
||||
|
||||
from django.conf.urls import *
|
||||
from django.urls import *
|
||||
|
||||
from profiles import views
|
||||
|
||||
|
@ -5,7 +5,7 @@ Views for creating, editing and viewing site-specific user profiles.
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse, resolve
|
||||
from django.http import Http404
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
7
req1.10.8+2.3.txt
Normal file
7
req1.10.8+2.3.txt
Normal file
@ -0,0 +1,7 @@
|
||||
confusable-homoglyphs==2.0.2
|
||||
Django==1.10.8
|
||||
django-registration==2.3
|
||||
Pillow==7.1.2
|
||||
six==1.15.0
|
||||
sqlparse==0.3.1
|
||||
Unidecode==1.1.1
|
@ -19,7 +19,7 @@ import urllib.parse
|
||||
|
||||
import django
|
||||
|
||||
print("** importing troggle/settings.py")
|
||||
print("* importing troggle/settings.py")
|
||||
|
||||
# Note that this builds upon the django system installed
|
||||
# global settings in
|
||||
@ -31,7 +31,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
# Django settings for troggle project.
|
||||
|
||||
|
||||
ALLOWED_HOSTS = ['expo.survex.com','localhost', '127.0.0.1']
|
||||
|
||||
ADMINS = (
|
||||
@ -103,7 +102,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# 'django.contrib.staticfiles',
|
||||
'registration',
|
||||
'troggle.profiles',
|
||||
'troggle.core',
|
||||
@ -146,4 +145,4 @@ TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||
from localsettings import *
|
||||
|
||||
#localsettings needs to take precedence. Call it to override any existing vars.
|
||||
print("++ finished importing troggle/settings.py")
|
||||
print("+ finished importing troggle/settings.py")
|
||||
|
37
urls.py
37
urls.py
@ -3,8 +3,10 @@ from django.conf.urls import *
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.views.generic.list import ListView
|
||||
from django.contrib import admin
|
||||
from django.contrib.staticfiles import views as staticviews
|
||||
|
||||
#from django.contrib.staticfiles import views as staticviews
|
||||
#from django.conf.urls.static import static
|
||||
from django.urls import reverse, resolve
|
||||
#
|
||||
from .core.views import * # flat import
|
||||
from .core.views_other import *
|
||||
from .core.views_caves import *
|
||||
@ -72,6 +74,7 @@ actualurlpatterns = [
|
||||
url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch),
|
||||
|
||||
url(r'^statistics/?$', views_statistics.stats, name="stats"),
|
||||
url(r'^stats/?$', views_statistics.stats, name="stats"),
|
||||
url(r'^pathsreport.*$', views_statistics.pathsreport, name="pathsreport"),
|
||||
|
||||
url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"),
|
||||
@ -82,8 +85,8 @@ actualurlpatterns = [
|
||||
|
||||
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')),
|
||||
url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then.
|
||||
url(r'^accounts/', include('registration.backends.default.urls')), # needed to log in!
|
||||
# url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then.
|
||||
|
||||
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
||||
url(r'^survexfile/(?P<survex_file>.*?)\.svx$', views_survex.svx, name="svx"),
|
||||
@ -95,33 +98,27 @@ actualurlpatterns = [
|
||||
url(r'^survexfile/(?P<survex_cave>.*)$', views_survex.survexcavesingle, name="survexcavessingle"),
|
||||
url(r'^survexfileraw/(?P<survex_file>.*?)\.svx$', views_survex.svxraw, name="svxraw"),
|
||||
|
||||
url(r'^survey_files/download/(?P<path>.*)$', view_surveys.download),
|
||||
# url(r'^survey_files/download/(?P<path>.*)$', view_surveys.download), # needs rewriting
|
||||
|
||||
#(r'^survey_scans/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.SURVEY_SCANS, 'show_indexes':True}),
|
||||
url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"),
|
||||
url(r'^survey_scans/(?P<path>[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"),
|
||||
# This next line is beyond daft. If anyone uploads a file *anywhere* in SURVEY_SCANS which doesn't match, troggle crashes horribly. Has been failing for pdf and JPG files for years:
|
||||
url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+(?:png|jpg|pdf|jpeg|PNG|JPG|PDF|JPEG))$',
|
||||
url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$',
|
||||
view_surveys.surveyscansingle, name="surveyscansingle"),
|
||||
|
||||
url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"),
|
||||
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"),
|
||||
url(r'^tunneldataraw/(?P<path>.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"),
|
||||
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"),
|
||||
url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"),
|
||||
|
||||
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
|
||||
|
||||
url(r'^expofiles/(?P<path>.*)$', staticviews.serve,
|
||||
{'document_root': settings.EXPOFILES, 'show_indexes': True}),
|
||||
url(r'^static/(?P<path>.*)$', staticviews.serve,
|
||||
{'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
|
||||
url(r'^site_media/(?P<path>.*)$', staticviews.serve,
|
||||
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
|
||||
# url(r'^troggle/media-admin/(?P<path>.*)$', staticviews.serve,
|
||||
# {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}),
|
||||
#url(r'^tinymce_media/(?P<path>.*)$', staticviews.serve,
|
||||
# {'document_root': settings.TINY_MCE_MEDIA_ROOT, 'show_indexes': True}),
|
||||
#url(r'^photos/(?P<path>.*)$', staticviews.serve,
|
||||
url(r'^expofiles/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # EXPOFILES
|
||||
url(r'^static/(?P<filepath>.*)$', view_surveys.cssfilessingle, name="single"), # MEDIA_ROOT: CSS and JS
|
||||
url(r'^site_media/(?P<filepath>.*)$', view_surveys.cssfilessingle, name="single"), # MEDIA_ROOT: CSS and JS
|
||||
# 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:
|
||||
# url(r'^photos/(?P<path>.*)$', staticviews.serve,
|
||||
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
|
||||
# url(r'^gallery/(?P<path>.*)$', staticviews.serve,
|
||||
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
|
||||
|
3
utils.py
3
utils.py
@ -45,8 +45,7 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
|
||||
defined in core.models.TroggleModel.
|
||||
|
||||
"""
|
||||
|
||||
instance, created=objectType.objects.get_or_create(defaults=nonLookupAttribs, **lookupAttribs)
|
||||
instance, created = objectType.objects.get_or_create(defaults=nonLookupAttribs, **lookupAttribs)
|
||||
|
||||
if not created and not instance.new_since_parsing:
|
||||
for k, v in list(nonLookupAttribs.items()): #overwrite the existing attributes from the logbook text (except date and title)
|
||||
|
Loading…
Reference in New Issue
Block a user