Django 2.2 breaks previously working views/urls

前端 未结 4 933
花落未央
花落未央 2021-01-18 23:52

Decided to take out Django 2.2 for a spin (project is currently running 2.1.8) and now I can\'t even get the server to start. I have been maintaining this project for nearly

4条回答
  •  臣服心动
    2021-01-19 00:18

    This is a two step problem:

    First, something changed with how Django is resolving paths to views. Whereas handler404 = 'views.error_404' worked on 2.1.8, the more explicit path handler404 = 'apps.dashboard.views.error_404' is required on 2.2.

    Second, I made a mistake with how I wrote my custom handler404 and a new system check caught it before the server starts. handler404 is supposed to be setup to take two arguments request, exception, whereas I had it simply setup to accept request. It may have been failing silently.

    I ran into a third error LookupError: No installed app with label 'admin' after I initially fixed the path, but after uninstalling and reinstalling 2.2, I have not been able to replicate it.

    Thanks to @Alasdair we've got a ticket open and it looks like this will be painless to fix in 2.2.1.

    I'm simply writing this answer to summarize the complete issue, as both of the fantastic answers previously given only cover one part. Thanks guys!

提交回复
热议问题