0

I just upgraded my django project from 1.8.5 to 2.0.6 version. I am able to go into the index page, but any other link gives me a 404 page. enter image description here. What are the problems? Great thanks beforehand.

Here is part of my urls.py

from django.conf.urls import *
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from . import views


urlpatterns = [
  url(r'^admin/', admin.site.urls),
  url(r'^historicalbackground/', views.historicalbackground, name="historicalbackground"),
 url(r'^organizations/$', views.organizations, name="Organizations page"),      
]

And here is the views.py

from django.views.generic.base import TemplateView
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import RequestContext, loader, Context
from django.template.loader import get_template
from django.shortcuts import render, render_to_response, redirect
from django.core import management, serializers
from .models import Person, Place, Org, Relationship, Page, Manuscript, PendingTranscription
from html.parser import HTMLParser
from tempfile import *
from .forms import ContactForm, ImportXMLForm, TranscribeForm
from django.core.mail import EmailMessage, send_mail
from django.views.generic import ListView, DetailView
from django.urls import reverse


def historicalbackground (request):
    return render(request, 'historicalbackground.html')

def organizations(request):
    return render(request, 'organizations.html')
S.Xia
  • 35
  • 5

1 Answers1

0

You probably haven't changed MIDDLEWARE_CLASSES to MIDDLEWARE, so the redirect from /historicalbackground to /historicalbackground/ isn't working. See this answer for more info.

Going from Django 1.8.x to 2.0.x is too big a jump. You miss all the deprecation warnings so you get weird behaviour like this. Get your project working on Django 1.11.x without deprecation warnings, then the upgrade to Django 2.0 will be much smoother.

Alasdair
  • 298,606
  • 55
  • 578
  • 516