Opened 7 years ago

Closed 7 years ago

#17033 closed Bug (invalid)

Flatpage app urls redirect to 404 template if custom handler404 is set and DEBUG = False

Reported by: kamelok Owned by: nobody
Component: contrib.flatpages Version: 1.3
Severity: Normal Keywords: handler404
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


It appears only if DEBUG = False, any url that is not in (and Flatpage app urls are not) redirect to 404.
If DEBUG = True - Flatpage app work as expected.
If remove handler404 from urls - also Flatpages app work as expected.

def custom_404_view(request):
        return render_to_response("404.html", {'event': Event.objects.get(pk=1)}, context_instance=RequestContext(request))

def custom_500_view(request):
        return render_to_response("500.html", {}, context_instance=RequestContext(request))

# Handlers for 404 and 500
handler404 = 'core.views.custom_404_view'
handler500 = 'core.views.custom_500_view'

Change History (1)

comment:1 Changed 7 years ago by Claude Paroz

Component: Uncategorizedcontrib.flatpages
Keywords: flatpages removed
Resolution: invalid
Status: newclosed

My guess is that as your custom_404_view does not return a 404 HTTP code, the fallback middleware does not catch it. Please try to return a HttpResponseNotFound response and reopen if you can still reproduce it.

Note: See TracTickets for help on using tickets.
Back to Top