Hello,
my shared server was recently upgraded. I am running an old version of django (3.0.4). After upgrading the venv, the django site started working again, except for one part, the admin interface.
The admin page is Django’s standard page. The code has never been altered for years.
From the browser I get an error 500 when I try to login.
From the debug log I can see this
Traceback (most recent call last):
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/gunicorn/workers/base_async.py", line 55, in handle
self.handle_request(listener_name, req, client, addr)
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/gunicorn/workers/ggevent.py", line 128, in handle_request
super().handle_request(listener_name, req, sock, addr)
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/gunicorn/workers/base_async.py", line 108, in handle_request
respiter = self.wsgi(environ, resp.start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
response = self.get_response(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/core/handlers/base.py", line 75, in get_response
response = self._middleware_chain(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/core/handlers/exception.py", line 36, in inner
response = response_for_exception(request, exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/core/handlers/exception.py", line 129, in handle_uncaught_exception
return callback(request, **param_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/views/defaults.py", line 97, in server_error
return HttpResponseServerError(template.render())
^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 171, in render
return self._render(context)
^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/defaulttags.py", line 309, in render
return nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/template/defaulttags.py", line 443, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/urls/base.py", line 87, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/urls/resolvers.py", line 677, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
This is my urls.py
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.sitemaps.views import sitemap
from .sitemaps import *
from . import views
sitemaps = {
'cammini':CamminiSitemap,
'vie':RouteSitemap,
'amici':FriendsSitemap,
'pagine':SiteSitemap(['home', 'about', 'links', 'book_list', 'cammini_list', 'friend_list']),
}
urlpatterns = [
path("i18n/", include("django.conf.urls.i18n")),
path('', views.home, name='home'),
path('chi/', views.about, name='about'),
path('robots.txt', views.robots),
path('admin/', admin.site.urls),
path('links/', include('links.urls')),
path('cammini/', include('cammini.urls')),
path('libri/', include('books.urls')),
path('amici/',include('friends.urls')),
path('sitemap.xml', sitemap, {'sitemaps':sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
]
urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
Can anyone help me solve this problem?