From 8f9b048c578cc8ca1efb368b2463f1f5e216fc35 Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Sat, 8 Jan 2022 13:33:05 +0100 Subject: [PATCH 1/2] Upgrade the stack from Django 2.2 to 3.2 --- REQUIREMENTS.txt | 18 ++++++++++++------ dockerize/docker/REQUIREMENTS.txt | 13 ++++++++----- qgis-app/REQUIREMENTS_plugins.txt | 12 +++++++----- qgis-app/users/views.py | 21 ++++++++++----------- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/REQUIREMENTS.txt b/REQUIREMENTS.txt index 5df4b5a4..1e8450cb 100644 --- a/REQUIREMENTS.txt +++ b/REQUIREMENTS.txt @@ -1,10 +1,14 @@ -Django==2.2.24 +Django==3.2.11 + # Currently broken with 'no module named defaults' error #Feedjack==0.9.18 # So use George's fork rather # git+https://github.com/Erve1879/feedjack.git -# George's is also broken: use my fork (django 1.8 ready) -git+https://github.com/elpaso/feedjack.git +# George's is also broken: use elpaso fork (django 1.8 ready) +# git+https://github.com/elpaso/feedjack.git +# His is also broken, use dimasciput (django 3.2 ready) +git+https://github.com/dimasciput/feedjack.git + Markdown==2.3.1 #PIL==1.1.7 Pillow @@ -16,7 +20,7 @@ argparse==1.2.1 django-annoying==0.7.7 django-auth-ldap==1.2.6 django-autoslug==1.7.1 -django-debug-toolbar==1.11.1 +django-debug-toolbar==3.2.4 django-endless-pagination==2.0 django-extensions==1.2.0 django-generic-aggregation==0.3.2 @@ -24,9 +28,11 @@ django-haystack==2.4.0 #django-olwidget==0.61.0 unmaintained, use this fork git+https://github.com/Christophe31/olwidget.git django-pagination==1.0.7 + # Unmaintained! #django-ratings==0.3.7 -git+https://github.com/enikesha/django-ratings.git +git+https://github.com/gelo-zhukov/django-ratings.git + django-simple-ratings==0.3.2 # SIMPLEMENU git+git://github.com/elpaso/django-simplemenu.git @@ -54,4 +60,4 @@ django-sortable-listview==0.43 django-user-map djangorestframework==3.12.2 django-rest-auth==0.9.5 -drf-yasg \ No newline at end of file +drf-yasg diff --git a/dockerize/docker/REQUIREMENTS.txt b/dockerize/docker/REQUIREMENTS.txt index c989818b..b7e46d5d 100644 --- a/dockerize/docker/REQUIREMENTS.txt +++ b/dockerize/docker/REQUIREMENTS.txt @@ -1,4 +1,4 @@ -django==2.2.24 +django==3.2.11 django-auth-ldap python-ldap django-taggit @@ -6,8 +6,10 @@ django-tinymce psycopg2 # Updates for Django 2 git+https://github.com/metamatik/django-templatetag-sugar.git -# Updates for Django 2 -git+https://github.com/elpaso/django-ratings.git@modernize + +# Updates for Django 3 +git+https://github.com/gelo-zhukov/django-ratings.git + django-taggit-autosuggest django-annoying # Updates for Django 2 @@ -20,7 +22,7 @@ django-bootstrap-pagination django-sortable-listview sorl-thumbnail django-extensions -django-debug-toolbar==1.11.1 +django-debug-toolbar==3.2.4 whoosh django-haystack @@ -29,8 +31,9 @@ django-haystack # git+https://github.com/Erve1879/feedjack.git # George's is also broken: use my fork (django 1.8 ready) # git+https://github.com/elpaso/feedjack.git -# His is also broken, use mine (django 2.2 ready) +# His is also broken, use dimasciput (django 3.2 ready) git+https://github.com/dimasciput/feedjack.git + feedparser==5.2.1 celery==4.3.1 requests==2.23.0 diff --git a/qgis-app/REQUIREMENTS_plugins.txt b/qgis-app/REQUIREMENTS_plugins.txt index 1bd875b0..bd9ca5ba 100644 --- a/qgis-app/REQUIREMENTS_plugins.txt +++ b/qgis-app/REQUIREMENTS_plugins.txt @@ -1,4 +1,4 @@ -django==2.2.24 +django==3.2.11 django-auth-ldap python-ldap django-taggit @@ -6,8 +6,10 @@ django-tinymce psycopg2 # Updates for Django 2 git+https://github.com/metamatik/django-templatetag-sugar.git -# Updates for Django 2 -git+https://github.com/elpaso/django-ratings.git@modernize + +# Updates for Django 3 +git+https://github.com/gelo-zhukov/django-ratings.git + django-taggit-autosuggest django-annoying # Updates for Django 2 @@ -20,6 +22,6 @@ django-bootstrap-pagination django-sortable-listview sorl-thumbnail django-extensions -django-debug-toolbar==1.11.1 +django-debug-toolbar==3.2.4 whoosh -django-haystack \ No newline at end of file +django-haystack diff --git a/qgis-app/users/views.py b/qgis-app/users/views.py index 23344cf1..37604192 100644 --- a/qgis-app/users/views.py +++ b/qgis-app/users/views.py @@ -1,7 +1,7 @@ from django.http import HttpResponse from django.http import HttpResponseRedirect from django.contrib import messages -from django.shortcuts import render_to_response, get_object_or_404 +from django.shortcuts import render, get_object_or_404 from annoying.functions import get_object_or_None from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ @@ -31,7 +31,9 @@ def usersMap(theRequest): myMap = InfoMap(users) - return render_to_response("view_users.html", + return render( + theRequest, + "view_users.html", { 'myMap' : myMap, 'myUserCount' : myUserCount, @@ -48,11 +50,11 @@ def createUser(theRequest): myForm.save() return HttpResponseRedirect("/community-map/view_users.html") else: - return render_to_response("create_user_form.html", {'myForm' : myForm, 'myUserCount' : myUserCount }, + return render(theRequest, "create_user_form.html", {'myForm' : myForm, 'myUserCount' : myUserCount }, context_instance=RequestContext(theRequest)) else: myForm = QgisUserForm() - return render_to_response("create_user_form.html", {'myForm' : myForm, 'myUserCount' : myUserCount }, + return render(theRequest, "create_user_form.html", {'myForm' : myForm, 'myUserCount' : myUserCount }, context_instance=RequestContext(theRequest)) @@ -64,12 +66,12 @@ def updateUser(theRequest, theId): if myForm.is_valid(): myForm.save() return HttpResponseRedirect("/community-map/view_users.html") - return render_to_response("update_user_form.html", { + return render(theRequest, "update_user_form.html", { 'myUser': myUser, 'myForm': myForm, 'myUserCount' : myUserCount }, context_instance=RequestContext(theRequest)) else: myForm = QgisUserForm(instance=myUser) - return render_to_response("update_user_form.html", {'myForm' : myForm, 'myUserCount' : myUserCount}, + return render(theRequest, "update_user_form.html", {'myForm' : myForm, 'myUserCount' : myUserCount}, context_instance=RequestContext(theRequest)) def emailEditAddress(theRequest): @@ -101,14 +103,11 @@ def emailEditAddress(theRequest): msg = _("User is NOT valid.") messages.warning(theRequest, msg, fail_silently=True) logging.info("User or form is NOT valid") - return render_to_response("update_user.html", {'myForm' : myForm, 'myUserCount' : myUserCount}, + return render(theRequest, "update_user.html", {'myForm' : myForm, 'myUserCount' : myUserCount}, context_instance=RequestContext(theRequest)) else: myUserCount = QgisUser.objects.all().count() myForm = EmailForm() - return render_to_response("update_user.html", {'myForm' : myForm}, + return render(theRequest, "update_user.html", {'myForm' : myForm}, context_instance=RequestContext(theRequest)) - - - From 0dabfe451c5000c0265ffecd84e3958b350d0bdd Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Mon, 10 Jan 2022 10:36:19 +0100 Subject: [PATCH 2/2] Upgrade pip as well when installing --- dockerize/docker/Dockerfile | 2 +- dockerize/production/Dockerfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerize/docker/Dockerfile b/dockerize/docker/Dockerfile index f2be2c8c..a77ab97b 100644 --- a/dockerize/docker/Dockerfile +++ b/dockerize/docker/Dockerfile @@ -7,7 +7,7 @@ MAINTAINER Dimas Ciputra RUN apt-get clean all RUN apt-get update && apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev ADD REQUIREMENTS.txt /REQUIREMENTS.txt -RUN pip install -r /REQUIREMENTS.txt +RUN pip install --upgrade pip && pip install -r /REQUIREMENTS.txt RUN pip install uwsgi # https://docs.docker.com/examples/running_ssh_service/ diff --git a/dockerize/production/Dockerfile b/dockerize/production/Dockerfile index 7a57d864..a51f6e85 100644 --- a/dockerize/production/Dockerfile +++ b/dockerize/production/Dockerfile @@ -14,6 +14,7 @@ RUN mkdir -p /usr/src; mkdir -p /home/web && \ ln -s /usr/src/plugins/qgis-app /home/web/django_project RUN cd /usr/src/plugins/dockerize/docker && \ + pip install --upgrade pip && \ pip install -r REQUIREMENTS.txt && \ pip install uwsgi && \ rm -rf /uwsgi.conf && \