NoReverseMatch at /admin/ error after upgrading Django

172 Views Asked by At

After I upgraded my Django project from 1.8 to 2.0, I try to log into the admin page, and receive this error message. I am able to see the login page, other links of the admin like "http://159.203.172.178/admin/QI/page/", but I can't see the first page only.admin error picture link

I definitely included too many code here because I really don't now where the problem is. Great thanks beforehand.

urls.py for admin:

from django.conf.urls import *
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from . import views
from django.urls import path,re_path,reverse,include

app_name="QI"

urlpatterns = [
    path('admin/', admin.site.urls),
]

settings.py:

 import os
 from .settings_secret import *

 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

 STATIC_URL = '/static/'

 STATIC_ROOT = os.path.join(BASE_DIR, 'static')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# Application definition

 INSTALLED_APPS = (
   'django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'import_export',
   'xml_tool',
   'haystack',
   'QI',
)

 MIDDLEWARE = (
    'django.middleware.security.SecurityMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',)

ROOT_URLCONF = 'QI.urls'

TEMPLATES = [
   {
       'BACKEND': 'django.template.backends.django.DjangoTemplates',
       'DIRS': [os.path.join(BASE_DIR, 'templates')],
       'APP_DIRS': True,
       'OPTIONS': {
           'context_processors': [
               'django.template.context_processors.debug',
               'django.template.context_processors.request',
               'django.template.context_processors.static',
               'django.contrib.auth.context_processors.auth',
               'django.contrib.messages.context_processors.messages',

The review_transcription_lists that is included in this html file:

{% extends 'admin/base_site.html' %}

{% load staticfiles %}


{% block extrastyle %}
<link rel="stylesheet" href="{% static 'admin/css/forms.css' %}">
<link rel="stylesheet" href="{% static 'admin/css/widgets.css' %}">
{% endblock %}

{% block content %}
<div id="content-main">
   <h1>All Unapproved Transcriptions</h1>
   <table>
   <thead>
     <tr>
     <th>Manuscript</th>
     <th>Date Transcribed</th>
     <th>Author</th>
   </tr>
  </thead>
 <tbody>
 {% for transcription in object_list %}
 <tr>
    <td><a href="/admin/review_transcriptions/{{ transcription.doc.id_tei }}">{{ transcription.doc.id_tei }}</a></td>
    <td>{{ transcription.uploaded }}</td>
    <td>{{ transcription.name }}</td>
 </tr>
 {% endfor %}
</table>
</div>
0

There are 0 best solutions below