Future-proof for django 4.0

Minor changes to make the code compatible with django 4.0

Note that we can't actually upgrade to django 4.0 because that requires
python 3.8, and www.eleves only has python 3.7, so we need to upgrade
www.eleves first.
This commit is contained in:
Basile Clement 2022-12-05 14:37:55 +01:00
parent 25a1b880e5
commit a26a77b508
3 changed files with 13 additions and 12 deletions

View file

@ -7,9 +7,12 @@ from django.contrib.messages import constants as messages
try: try:
from . import secret from . import secret
except ImportError: except ImportError:
import pathlib
dir_path = pathlib.Path(__file__).parent.resolve().as_posix()
raise ImportError( raise ImportError(
"The secret.py file is missing.\n" "The secret.py file is missing.\n"
"For a development environment, simply copy secret_example.py" "For a development environment, simply copy secret_example.py:\n"
f" $ cp {dir_path}/{{secret_example,secret}}.py"
) )

View file

@ -1,23 +1,22 @@
from django.conf.urls import url, include from django.conf.urls import include
from django.urls import re_path
from django.contrib import admin from django.contrib import admin
from allauth_ens.views import capture_login, capture_logout from allauth_ens.views import capture_login, capture_logout
from wiki.urls import get_pattern as get_wiki_pattern
from django_nyt.urls import get_pattern as get_nyt_pattern
allauth_urls = [ allauth_urls = [
# Catch login/logout views of admin site. # Catch login/logout views of admin site.
url(r'^_admin/login/$', capture_login), re_path(r'^_admin/login/$', capture_login),
url(r'^_admin/logout/$', capture_logout), re_path(r'^_admin/logout/$', capture_logout),
# Allauth urls. # Allauth urls.
url(r'^_profil/', include('allauth.urls')), re_path(r'^_profil/', include('allauth.urls')),
] ]
urlpatterns = allauth_urls + [ urlpatterns = allauth_urls + [
url(r'^_admin/', admin.site.urls), re_path(r'^_admin/', admin.site.urls),
url(r'^notifications/', get_nyt_pattern()), re_path(r'^notifications/', include('django_nyt.urls')),
url(r'^_groups/', include("wiki_groups.urls")), re_path(r'^_groups/', include("wiki_groups.urls")),
url(r'', get_wiki_pattern()), re_path(r'', include('wiki.urls')),
] ]
# TODO add MEDIA_ROOT # TODO add MEDIA_ROOT

View file

@ -1 +0,0 @@
default_app_config = "wiki_groups.apps.WikiGroupsConfig"