Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New host setup #374

Merged
merged 36 commits into from
May 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f7a37c6
Upgrade the stack from Django 2.2 to 3.2 (#233)
Gustry Aug 21, 2022
d4c8550
Update docker compose (#256)
dimasciput Aug 21, 2022
4a2431a
Fix docker-compose and dockerfile
Xpirix Nov 22, 2023
ada9b42
Merge branch 'master' of github.com:Xpirix/QGIS-Django into update_dj…
Xpirix Nov 22, 2023
a8349fd
Init starting docker dev environment
Xpirix Nov 22, 2023
ee066d2
Fixing docker container conflict, updating whoosh
Xpirix Nov 23, 2023
303bad8
Update testfiles and feedback test
Xpirix Nov 23, 2023
8559721
Update dockerfile for dev and prod
Xpirix Nov 23, 2023
8c46fed
Merge branch 'master' into update_django
Xpirix Feb 12, 2024
04c5ffe
Use main branch for whoosh in requirements
Xpirix Feb 13, 2024
a947f26
Merge branch 'master' of github.com:Xpirix/QGIS-Django into new_host_…
Xpirix Mar 20, 2024
16434e4
Django 4 update: Requirements, dockerfile and docker-compose
Xpirix Mar 21, 2024
c93fac6
Django 4 update: fixes for ifequal, ugettext_lazy, django.conf.urls.u…
Xpirix Mar 21, 2024
6e50f73
Django 4 update: Fix deprecated readfp
Xpirix Mar 21, 2024
63cfd3e
Django 4 update: update dbrestore in Makefile
Xpirix Mar 21, 2024
9d250fc
Django 4 update: Get static, media and backup volumes from the enviro…
Xpirix Mar 21, 2024
9dfbd35
Django 4 update: Use solr thumbnail default engine
Xpirix Mar 21, 2024
bd64930
Django 4 update: Fix Django warnings
Xpirix Mar 21, 2024
56f0ca8
Django 4 update: fix depecated tests, new migrations
Xpirix Mar 22, 2024
f0119d5
Django 4 update: Update django unit tests
Xpirix Mar 22, 2024
ecf9d40
Django 4 update: Add email environment variables
Xpirix Mar 22, 2024
e488644
Django 4 update: Nginx and uwsgi updates
Xpirix Mar 22, 2024
26de6e1
Django 4 update: Refactoring dockerfile
Xpirix Mar 22, 2024
1921119
Update makefile to use new docker compose
Xpirix Mar 27, 2024
c112431
Django 4 update: Specify devweb container_name, fix typo
Xpirix Mar 27, 2024
4466e94
Use existing nginx configuration
Xpirix Mar 27, 2024
d5483dd
Add DEFAULT_PLUGINS_SITE to environment variables
Xpirix Mar 28, 2024
ce76edc
Add nginx dev and prod configuration files
Xpirix Apr 2, 2024
9abe60f
Django 4 update: Generate a .env file in GH actions
Xpirix Apr 2, 2024
d6a7b2b
Django 4 update: Fix typo in Makefile
Xpirix Apr 2, 2024
fe4dd07
Django 4 update: Use updated docker compose in test.yaml
Xpirix Apr 2, 2024
0529d52
Django 4 update: Certbot service and SSL configuration
Xpirix Apr 5, 2024
b660449
Add a http configuration for Nginx
Xpirix Apr 16, 2024
68fc44e
Django 4 update: add SSL cert renewal script
Xpirix Apr 23, 2024
8ff8de2
Redirect http to https
Xpirix May 3, 2024
d8f23a5
Merge branch 'master' into new_host_setup
Xpirix May 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Django 4 update: fixes for ifequal, ugettext_lazy, django.conf.urls.u…
…rl occurences
Xpirix committed Mar 21, 2024
commit c93fac69fe5b28350f0b33c65e27a6cd389213ee
2 changes: 1 addition & 1 deletion qgis-app/base/forms/processing_forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from base.validator import filesize_validator
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class ResourceBaseReviewForm(forms.Form):
2 changes: 1 addition & 1 deletion qgis-app/base/models/processing_models.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class UnapprovedManager(models.Manager):
2 changes: 1 addition & 1 deletion qgis-app/base/validator.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

RESOURCE_MAX_SIZE = getattr(settings, "RESOURCE_MAX_SIZE", 1000000) # 1MB
ERROR_FILESIZE_TOO_BIG = ValidationError(
2 changes: 1 addition & 1 deletion qgis-app/base/views/processing_view.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
from django.urls import reverse, reverse_lazy
from django.utils.decorators import method_decorator
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
from django.views.generic import (
CreateView,
2 changes: 1 addition & 1 deletion qgis-app/custom_haystack_urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Custom haystack search to match partial strings

from django.conf.urls import include, url
from django.urls import re_path as url
from haystack.query import SearchQuerySet
from haystack.views import SearchView

2 changes: 1 addition & 1 deletion qgis-app/geopackages/models.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from django.core.validators import FileExtensionValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

GEOPACKAGES_STORAGE_PATH = getattr(
settings, "GEOPACKAGE_STORAGE_PATH", "geopackages/%Y"
2 changes: 1 addition & 1 deletion qgis-app/homepage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.flatpages.models import FlatPage
from django.shortcuts import render
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from plugins.models import Plugin

# from feedjack.models import Post
2 changes: 1 addition & 1 deletion qgis-app/layerdefinitions/file_handler.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
import xml.etree.ElementTree as ET

from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


def parse_qlr(xmlfile):
2 changes: 1 addition & 1 deletion qgis-app/layerdefinitions/models.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from django.core.validators import FileExtensionValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

LAYERDEFINITIONS_STORAGE_PATH = getattr(
settings, "LAYERDEFINITION_STORAGE_PATH", "layerdefinitions"
2 changes: 1 addition & 1 deletion qgis-app/models/models.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from django.core.validators import FileExtensionValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

MODELS_STORAGE_PATH = getattr(settings, "MODELS_STORAGE_PATH", "models/%Y")

2 changes: 1 addition & 1 deletion qgis-app/models/validator.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

MODEL_MAX_SIZE = getattr(settings, "MODEL_MAX_SIZE", 1000000) # 1MB

2 changes: 1 addition & 1 deletion qgis-app/plugins/api.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@

# Transaction
from django.db import IntegrityError, connection
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from plugins.models import *
from plugins.validator import validator
from plugins.views import plugin_notify
2 changes: 1 addition & 1 deletion qgis-app/plugins/forms.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from django.contrib.auth.models import User
from django.forms import CharField, ModelForm, ValidationError
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from plugins.models import Plugin, PluginOutstandingToken, PluginVersion, PluginVersionFeedback
from plugins.validator import validator
from taggit.forms import *
14 changes: 14 additions & 0 deletions qgis-app/plugins/migrations/0009_merge_20240321_0207.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 4.2.11 on 2024-03-21 02:07

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('plugins', '0004_merge_20231123_0018'),
('plugins', '0008_merge_20240206_0448'),
]

operations = [
]
2 changes: 1 addition & 1 deletion qgis-app/plugins/models.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from djangoratings.fields import AnonymousRatingField
from taggit_autosuggest.managers import TaggableManager
4 changes: 2 additions & 2 deletions qgis-app/plugins/templates/plugins/form_snippet.html
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<fieldset>
{% for field in form %}
<div class="fieldWrapper {{ field.css_classes }}">
{% ifequal field.field.widget|klass 'CheckboxInput' %}
{% if field.field.widget|klass == 'CheckboxInput' %}
<label for="{{ field.html_name }}" class="{{ field.css_classes }}">
{{ field.label }}
{% if field.errors %}
@@ -20,7 +20,7 @@
</div>
{% endif %}
{{ field }}
{% endifequal %}
{% endif %}
<div class="help">{{ field.help_text }}</div>
</div>
{% endfor %}
4 changes: 2 additions & 2 deletions qgis-app/plugins/templates/plugins/pagination.html
Original file line number Diff line number Diff line change
@@ -8,11 +8,11 @@
{% endif %}
{% for page in pages %}
{% if page %}
{% ifequal page page_obj.number %}
{% if page == page_obj.number %}
<span class="current page">{{ page }}</span>
{% else %}
<a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page">{{ page }}</a>
{% endifequal %}
{% endif %}
{% else %}
...
{% endif %}
4 changes: 2 additions & 2 deletions qgis-app/plugins/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.urls import re_path as url
from django.contrib.auth.decorators import login_required, user_passes_test
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from plugins.models import Plugin, PluginVersion
from plugins.views import *
from rpc4django.views import serve_rpc_request
2 changes: 1 addition & 1 deletion qgis-app/plugins/validator.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

PLUGIN_MAX_UPLOAD_SIZE = getattr(settings, "PLUGIN_MAX_UPLOAD_SIZE", 25000000) # 25 mb
PLUGIN_REQUIRED_METADATA = getattr(
2 changes: 1 addition & 1 deletion qgis-app/plugins/views.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
from django.utils.timezone import now
from django.utils.decorators import method_decorator
from django.utils.encoding import DjangoUnicodeDecodeError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt, csrf_protect
from django.views.decorators.http import require_POST
4 changes: 3 additions & 1 deletion qgis-app/qgis_context_processor.py
Original file line number Diff line number Diff line change
@@ -2,12 +2,14 @@
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured

def is_ajax(request):
return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'

def additions(request):
"""Insert some additional information into the template context
from the settings and set the base template according to qs.
"""
if request.is_ajax() or request.GET.get("ajax"):
if is_ajax(request=request) or request.GET.get("ajax"):
base_template = "ajax_base.html"
is_naked = True
else:
7 changes: 4 additions & 3 deletions qgis-app/settings_docker.py
Original file line number Diff line number Diff line change
@@ -10,13 +10,14 @@
from datetime import timedelta
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage

DEBUG = ast.literal_eval(os.environ.get("DEBUG", "True"))
# DEBUG = ast.literal_eval(os.environ.get("DEBUG", "True"))
DEBUG = True
THUMBNAIL_DEBUG = DEBUG
ALLOWED_HOSTS = ["*"]

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = os.environ.get("MEDIA_ROOT", "/home/web/media")
MEDIA_ROOT = os.environ.get("MEDIA_ROOT", "/home/web/media/")

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
@@ -29,7 +30,7 @@
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.environ.get("STATIC_ROOT", "/home/web/static")
STATIC_ROOT = os.environ.get("STATIC_ROOT", "/home/web/static/")

# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
2 changes: 1 addition & 1 deletion qgis-app/styles/file_handler.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
import xml.etree.ElementTree as ET

from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


def _check_name_type_attribute(element):
2 changes: 1 addition & 1 deletion qgis-app/styles/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from styles.file_handler import validator
from styles.models import Style

2 changes: 1 addition & 1 deletion qgis-app/styles/models.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
from django.core.validators import FileExtensionValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

STYLES_STORAGE_PATH = getattr(settings, "PLUGINS_STORAGE_PATH", "styles/%Y")

2 changes: 1 addition & 1 deletion qgis-app/styles/views.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse, reverse_lazy
from django.utils.crypto import get_random_string
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
from styles.file_handler import read_xml_style
from styles.forms import UpdateForm, UploadForm
6 changes: 3 additions & 3 deletions qgis-app/templates/cab/snippet_detail.html
Original file line number Diff line number Diff line change
@@ -56,17 +56,17 @@ <h3>More like this</h3>
<h3>Tools</h3>
<ul class="menu">
{% if user.is_authenticated %}
{% ifequal user.id object.author.id %}
{% if user.id == object.author.id %}
<li><a href="/snippets/{{ object.id }}/edit/">Edit this snippet</a></li>
{% endifequal %}
{% endif %}
{% if object|is_bookmarked:request.user %}
<li>This snippet is in <a href="/bookmarks/">your bookmarks</a></li>
{% else %}
<li><a href="/bookmarks/add/{{ object.id }}/">Bookmark this snippet</a></li>
{% endif %}
{% with object|rating_score:request.user as rating_score %}
{% if rating_score %}
<li>You rated this snippet <strong>{% ifequal rating_score 1 %}useful{% else %}not useful{% endifequal %}</strong>.</li>
<li>You rated this snippet <strong>{% if rating_score == 1 %}useful{% else %}not useful{% endif %}</strong>.</li>
{% else %}
<li>Rate this snippet: <a href="/snippets/{{ object.id }}/rate/?score=up">useful</a> or <a href="/snippets/{{ object.id }}/rate/?score=down">not useful</a></li>
{% endif %}
2 changes: 1 addition & 1 deletion qgis-app/templates/snippet_base.html
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ <h1><a href="/snippets/">QGIS Snippets</a></h1>
{% if user.is_authenticated %}
Logged in as <a href="/users/{{ user.username }}/">{{ user.username }}</a> (<a href="/snippets/add/">Add a snippet</a>) (<a href="/accounts/logout/">Log out</a>)
{% else %}
<a href="/accounts/login/?next={% ifequal request.path "/accounts/logout/" %}/{% else %}{{ request.path }}{% endifequal %}">Log in</a> or <a href="/accounts/register/">register</a>
<a href="/accounts/login/?next={% if request.path == '/accounts/logout/' %}/{% else %}{{ request.path }}{% endif %}">Log in</a> or <a href="/accounts/register/">register</a>
{% endif %}
</span>
<ul>
2 changes: 1 addition & 1 deletion qgis-app/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import simplemenu
from django.conf import settings
from django.conf.urls import url
from django.urls import re_path as url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
2 changes: 1 addition & 1 deletion qgis-app/userexport/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -* coding:utf-8 *- #
from django.conf.urls import *
from django.urls import re_path as url
from userexport.views import *

urlpatterns = [
2 changes: 1 addition & 1 deletion qgis-app/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import re_path as url
from django.views.generic.base import TemplateView

from .views import *
2 changes: 1 addition & 1 deletion qgis-app/users/views.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
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 _
from django.utils.translation import gettext_lazy as _
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
2 changes: 1 addition & 1 deletion qgis-app/wavefronts/models.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
from django.core.validators import FileExtensionValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from preferences.models import Preferences

WAVEFRONTS_STORAGE_PATH = getattr(settings, "WAVEFRONTS_STORAGE_PATH", "wavefronts")
2 changes: 1 addition & 1 deletion qgis-app/wavefronts/validator.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
import pywavefront
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from wavefronts.models import WAVEFRONTS_STORAGE_PATH


2 changes: 1 addition & 1 deletion qgis-app/wavefronts/views.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
from django.template.response import TemplateResponse
from django.urls import reverse_lazy
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from wavefronts.forms import UpdateForm, UploadForm
from wavefronts.models import Review, Wavefront
from wavefronts.utilities import zipped_all_with_license