search

Home  >  Q&A  >  body text

python - Django问题 'WSGIRequest' object has no attribute 'user'

当我的django是1.9的时候 我进入/admin会有这个报错
但是当django版本是1.10.2的时候就不会有
请大神解疑惑

ringa_leeringa_lee2784 days ago864

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-18 10:23:54

    This is a problem with the Django version. Before 1.9, the middleware key is MIDDLEWARE_CLASSES, and after 1.9, it is MIDDLEWARE. Therefore, when the versions of the development environment and other environments are inconsistent, be particularly careful as there may be pitfalls.

    You need to change MIDDLEWARE to MIDDLEWARE_CLASSES in settings

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:23:54

    Generally when an error is reported saying that an object lacks a certain attribute, it is very likely that the object is actually None. I don’t know the specific situation here.

    reply
    0
  • Cancelreply