Admin interface no longer working after server update

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?

Use a version of Python compatible with your version of Django.

See Django 3.0 release notes | Django documentation | Django and FAQ: Installation | Django documentation | Django

Thanks for the advice, many warnings went away after downgrading to python 3.7 but i still get the 500 error

This is the trackback from debug

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/site-packages/django/views/defaults.py", line 97, in server_error
    return HttpResponseServerError(template.render())
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/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.7/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.

That seems pretty explicit to me. It’s telling you that you don’t have a url defined with the name login.

What are the specific circumstances under which you’re getting this error? (What page are you currently on? Are you getting this from a link or are you entering the url directly? Are you getting it when trying to go to a page, or when you’re submitting something from a form on a page?)

I’m getting this when I click the “login” button on the /admin page (address typed in manually).

The page is defined as follows in urls.py

path('admin/', admin.site.urls),

Do you have a LOGIN_URL in your settings.py?

Please show your INSTALLED_APPS and MIDDLEWARE settings.

I don’t have a LOGIN_URL in settings.py.

INSTALLED_APPS and MIDDLEWARE are as follows:

INSTALLED_APPS = [
    'cammini',
    'friends',
    'books',
    'links',
    'imagekit',
    'django_filters',
    'django.contrib.gis',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

Have you created a template in any of your apps to override the system-provided login template?

Also, what is your TEMPLATES setting?

The only login form is in the admin page and should be the system-provided one.

This is my templates setting

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['camminiverticali_2_0/templates',],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Check to see if you have any file named login.html anywhere within your project or anywhere within the third-party libraries being used. If you find any, post their complete location here.

Check to see if you have done any configuration of the AdminSite. If so, post those configuration settings.

oppilifitrof@s23:~/camminiverticali_2_0$ find . -name login.html -print
./.virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/contrib/admin/templates/admin/login.html
./dproject/templates/registration/login.html

this is the content of dproject/templates/registration/login.html

{% extends "registration/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}

{% block title %}{% trans 'Log in' %}{% endblock %}

{% block inner %}
<div class="text-center">
  <h2>{% trans 'Log in' %}</h2>
</div>
<form class="login" method="post" action=".">
  {% csrf_token %}
  {{ form|crispy }}
  <div class="form-group text-center">
    <button class="btn btn-primary" type="submit">{% trans "Log in" %}</button>
  </div>
</form>
{% endblock %}

and this is the content of .virtualenvs/camminiverticali_2_0/lib/python3.11/site-packages/django/contrib/admin/templates/admin/login.html

{% extends "admin/base_site.html" %}
{% load i18n static %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}">
{{ form.media }}
{% endblock %}

{% block bodyclass %}{{ block.super }} login{% endblock %}

{% block usertools %}{% endblock %}

{% block nav-global %}{% endblock %}

{% block content_title %}{% endblock %}

{% block breadcrumbs %}{% endblock %}

{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
</p>
{% endif %}

{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<p class="errornote">
    {{ error }}
</p>
{% endfor %}
{% endif %}

<div id="content-main">

{% if user.is_authenticated %}
<p class="errornote">
{% blocktrans trimmed %}
    You are authenticated as {{ username }}, but are not authorized to
    access this page. Would you like to login to a different account?
{% endblocktrans %}
</p>
{% endif %}

<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
  <div class="form-row">
    {{ form.username.errors }}
    {{ form.username.label_tag }} {{ form.username }}
  </div>
  <div class="form-row">
    {{ form.password.errors }}
    {{ form.password.label_tag }} {{ form.password }}
    <input type="hidden" name="next" value="{{ next }}">
  </div>
  {% url 'admin_password_reset' as password_reset_url %}
  {% if password_reset_url %}
  <div class="password-reset-link">
    <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
  </div>
  {% endif %}
  <div class="submit-row">
    <label>&nbsp;</label><input type="submit" value="{% trans 'Log in' %}">
  </div>
</form>

</div>
{% endblock %}

The various objects from the apps are managed through the admin interface

from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
#from django.contrib.gis import OSMGeoAdmin
from django.utils.safestring import mark_safe
# Register your models here.
from .models import *
from .forms import CamminoAdminForm
from imagekit.admin import AdminThumbnail



@admin.register(Peak)
class PeakAdmin(OSMGeoAdmin):
    default_lon = 1009310
    default_lat = 5790301
    default_zoom = 8
    list_display = ('name', 'location')


#admin.site.register(Route)



class CamminoImageAdmin(admin.ModelAdmin):
    admin_photo = AdminThumbnail(image_field='thumbnail')
    list_display = [
        'admin_photo',
        'image',
        'caption',
        'cammino'
    ]
    #readonly_fields = ['admin_photo']


admin.site.register(CamminoImage, CamminoImageAdmin)

so is for friends and books

from django.contrib import admin

# Register your models here.
from .models import Friend

admin.site.register(Friend)

from django.contrib import admin

# Register your models here.
from .models import *


admin.site.register (Author)
admin.site.register (Press)

@admin.register (Book)
class BookAdmin(admin.ModelAdmin):
    filter_horizontal = ('authors',)

In views there is nothing related to admin/login

from django.shortcuts import render
from django.http import HttpResponse


def home(request):
    return render(request, 'camminiverticali/home.html')


def about(request):
    return render(request, 'camminiverticali/presentazione.html')


def search(request):
    return render(request, 'camminiverticali/search.html')


def robots(request):
    return HttpResponse('robots')

Also the views from within the three apps don’t mention login

May need to dig a little deeper here.

The first line of the traceback you posted was:

What was the traceback above this line?

The trackback is very long

[2024-07-02 17:29:10 +0000] [3784078] [ERROR] Error handling request /admin/login/?next=/admin/
Traceback (most recent call last):
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 407, in login
    return LoginView.as_view(**defaults)(request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/contrib/auth/views.py", line 63, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/views/generic/edit.py", line 141, in post
    if form.is_valid():
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/forms/forms.py", line 180, in is_valid
    return self.is_bound and not self.errors
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/forms/forms.py", line 175, in errors
    self.full_clean()
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/forms/forms.py", line 377, in full_clean
    self._clean_form()
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/forms/forms.py", line 404, in _clean_form
    cleaned_data = self.clean()
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/contrib/auth/forms.py", line 214, in clean
    self.user_cache = authenticate(self.request, username=username, password=password)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/contrib/auth/__init__.py", line 72, in authenticate
    user = backend.authenticate(request, **credentials)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/contrib/auth/backends.py", line 46, in authenticate
    user = UserModel._default_manager.get_by_natural_key(username)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 44, in get_by_natural_key
    return self.get(**{self.model.USERNAME_FIELD: username})
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/query.py", line 411, in get
    num = len(clone)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/query.py", line 258, in __len__
    self._fetch_all()
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/query.py", line 1261, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/query.py", line 57, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1184, in execute_sql
    return list(result)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1583, in cursor_iter
    for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1583, in <lambda>
    for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/utils.py", line 97, in inner
    return func(*args, **kwargs)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/db/backends/postgresql/utils.py", line 6, in utc_tzinfo_factory
    raise AssertionError("database connection isn't set to UTC")
AssertionError: database connection isn't set to UTC

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
    response = response or self.get_response(request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/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.7/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.7/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.7/site-packages/django/views/defaults.py", line 97, in server_error
    return HttpResponseServerError(template.render())
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/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.7/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.
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/utils/deprecation.py", line 94, in __call__
    response = response or self.get_response(request)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/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.7/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.7/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.7/site-packages/django/views/defaults.py", line 97, in server_error
    return HttpResponseServerError(template.render())
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/defaulttags.py", line 309, in render
    return nodelist.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 936, in render
    bit = node.render_annotated(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/site-packages/django/template/base.py", line 903, in render_annotated
    return self.render(context)
  File "/home/oppilifitrof/.virtualenvs/camminiverticali_2_0/lib/python3.7/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.7/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.7/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.

And it repeats the same error message for something like 10 times

The last portion of the original traceback:

That is really interesting.

Other than the password (which you should remove or obfuscate), what is your DATABASES setting?

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'oppilifitrof_camminiverticali',
        'USER': '*******',
        'PASSWORD': '*******',
        'HOST':'localhost',
        'PORT':'5432',
     }
}

Thank you for pointing out the problem of Database time. I found some discussion on stackoverflow underlining an incompatibility between my versions of psycopg2 and django 3.0. The problem can be either solved by upgrading django or downgrading psycopg2. I tried with the latter and now the admin page is working.
Thanks very much for your patience