From 2c2c815b25a12adec18e424b288f6f5e3cda1226 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Sun, 15 Apr 2018 12:00:59 +0100 Subject: [PATCH] Up to 1.6.11 on stretch. New manage.py. Some tidying --- core/forms.py | 2 +- docker/Dockerfile | 12 ++++++++++-- docker/Dockerfile-django-1.5.12-jessie | 26 ++++++++++++++++++++++++++ docker/backports.list | 1 + docker/requirements.txt | 2 +- docker/requirements.txt.dj-1.5.12 | 7 +++++++ manage.py | 13 +++++-------- parsers/surveys.py | 6 +----- 8 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 docker/Dockerfile-django-1.5.12-jessie create mode 100644 docker/backports.list create mode 100644 docker/requirements.txt.dj-1.5.12 diff --git a/core/forms.py b/core/forms.py index 4530b0e..5adb7a1 100644 --- a/core/forms.py +++ b/core/forms.py @@ -62,7 +62,7 @@ class EntranceForm(ModelForm): -CaveAndEntranceFormSet = modelformset_factory(CaveAndEntrance, exclude=('cave')) +CaveAndEntranceFormSet = modelformset_factory(CaveAndEntrance, exclude=('cave',)) class EntranceLetterForm(ModelForm): class Meta: diff --git a/docker/Dockerfile b/docker/Dockerfile index 2fcb51c..c11a8b0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,10 @@ -FROM python:2.7-jessie +FROM python:2.7-stretch -RUN apt-get -y update && apt-get install -y mercurial fonts-freefont-ttf survex locales +#COPY backports.list /etc/apt/sources.list.d/ + +RUN apt-get -y update && apt-get install -y mercurial fonts-freefont-ttf locales survex + +#RUN apt-get -y -t -backports install survex # Set the locale RUN locale-gen en_GB.UTF-8 @@ -11,8 +15,12 @@ ENV LC_ALL en_GB.UTF-8 WORKDIR /opt/expo/troggle COPY requirements.txt . +RUN pip install --upgrade pip + RUN pip install -r requirements.txt EXPOSE 8000 +WORKDIR /expo/troggle + #CMD ["python","manage.py","runserver","0.0.0.0:8000"] \ No newline at end of file diff --git a/docker/Dockerfile-django-1.5.12-jessie b/docker/Dockerfile-django-1.5.12-jessie new file mode 100644 index 0000000..2cf1a51 --- /dev/null +++ b/docker/Dockerfile-django-1.5.12-jessie @@ -0,0 +1,26 @@ +FROM python:2.7-jessie + +COPY backports.list /etc/apt/sources.list.d/ + +RUN apt-get -y update && apt-get install -y mercurial fonts-freefont-ttf locales + +RUN apt-get -y -t jessie-backports install survex + +# Set the locale +RUN locale-gen en_GB.UTF-8 +ENV LANG en_GB.UTF-8 +ENV LANGUAGE en_GB:en +ENV LC_ALL en_GB.UTF-8 + +WORKDIR /opt/expo/troggle +COPY requirements.txt . + +RUN pip install --upgrade pip + +RUN pip install -r requirements.txt + +EXPOSE 8000 + +WORKDIR /expo/troggle + +#CMD ["python","manage.py","runserver","0.0.0.0:8000"] \ No newline at end of file diff --git a/docker/backports.list b/docker/backports.list new file mode 100644 index 0000000..c29532b --- /dev/null +++ b/docker/backports.list @@ -0,0 +1 @@ +deb http://ftp.debian.org/debian jessie-backports main \ No newline at end of file diff --git a/docker/requirements.txt b/docker/requirements.txt index 9f9b5ae..b26bc10 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -1,4 +1,4 @@ -Django==1.5.12 +Django==1.6.11 django-registration==1.0 mysql imagekit diff --git a/docker/requirements.txt.dj-1.5.12 b/docker/requirements.txt.dj-1.5.12 new file mode 100644 index 0000000..9f9b5ae --- /dev/null +++ b/docker/requirements.txt.dj-1.5.12 @@ -0,0 +1,7 @@ +Django==1.5.12 +django-registration==1.0 +mysql +imagekit +Image +django-tinymce==1.5.3 +smartencoding diff --git a/manage.py b/manage.py index 5e78ea9..bd52fd6 100644 --- a/manage.py +++ b/manage.py @@ -1,11 +1,8 @@ #!/usr/bin/env python -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) +import os, sys if __name__ == "__main__": - execute_manager(settings) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + from django.core.management import execute_from_command_line + execute_from_command_line(sys.argv) + diff --git a/parsers/surveys.py b/parsers/surveys.py index df73ae0..b94481e 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -138,7 +138,7 @@ def parseSurveyScans(expedition, logfile=None): # dead def parseSurveys(logfile=None): - readSurveysFromCSV() + readSurveysFromCSV() for expedition in Expedition.objects.filter(year__gte=2000): #expos since 2000, because paths and filenames were nonstandard before then parseSurveyScans(expedition) @@ -298,7 +298,3 @@ def LoadTunnelFiles(): for tunnelfile in TunnelFile.objects.all(): SetTunnelfileInfo(tunnelfile) - - - -