1. <i id='dQvmH'><tr id='dQvmH'><dt id='dQvmH'><q id='dQvmH'><span id='dQvmH'><b id='dQvmH'><form id='dQvmH'><ins id='dQvmH'></ins><ul id='dQvmH'></ul><sub id='dQvmH'></sub></form><legend id='dQvmH'></legend><bdo id='dQvmH'><pre id='dQvmH'><center id='dQvmH'></center></pre></bdo></b><th id='dQvmH'></th></span></q></dt></tr></i><div id='dQvmH'><tfoot id='dQvmH'></tfoot><dl id='dQvmH'><fieldset id='dQvmH'></fieldset></dl></div>
          <bdo id='dQvmH'></bdo><ul id='dQvmH'></ul>

        <tfoot id='dQvmH'></tfoot>

      1. <small id='dQvmH'></small><noframes id='dQvmH'>

      2. <legend id='dQvmH'><style id='dQvmH'><dir id='dQvmH'><q id='dQvmH'></q></dir></style></legend>

        Django 中间件错误 - 为 1.7 更改了中间件

        Django Middleware Error - Middleware changed for 1.7(Django 中间件错误 - 为 1.7 更改了中间件)
      3. <legend id='AevGO'><style id='AevGO'><dir id='AevGO'><q id='AevGO'></q></dir></style></legend>
                <tbody id='AevGO'></tbody>

                <small id='AevGO'></small><noframes id='AevGO'>

              • <tfoot id='AevGO'></tfoot>

                <i id='AevGO'><tr id='AevGO'><dt id='AevGO'><q id='AevGO'><span id='AevGO'><b id='AevGO'><form id='AevGO'><ins id='AevGO'></ins><ul id='AevGO'></ul><sub id='AevGO'></sub></form><legend id='AevGO'></legend><bdo id='AevGO'><pre id='AevGO'><center id='AevGO'></center></pre></bdo></b><th id='AevGO'></th></span></q></dt></tr></i><div id='AevGO'><tfoot id='AevGO'></tfoot><dl id='AevGO'><fieldset id='AevGO'></fieldset></dl></div>
                  <bdo id='AevGO'></bdo><ul id='AevGO'></ul>
                  本文介绍了Django 中间件错误 - 为 1.7 更改了中间件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  每当我使用我的 django 项目运行本地服务器时,我都会收到一条警告和一条错误消息,指出在 Django 1.7 中全局中间件类已更改——即使我使用的是 1.8.我的博客,位于 http://127.0.0.1:8000/,加载正常,但是当我尝试加载我在/admin/'WSGIRequest' 对象处得到 AttributeError 的管理站点没有属性 'user',据我所知,这与中间件有关.提前感谢您的帮助

                  Whenever I run my local server with my django project I am getting a warning and an error message saying that in Django 1.7 the global middleware classes were changed - even though I am using 1.8. My blog, at http://127.0.0.1:8000/, loads fine, but when I try to load the admin site I get AttributeError at /admin/ 'WSGIRequest' object has no attribute 'user', which as far as I can tell is to do with the Middleware. Thanks for your help in advance

                  我的中间件:

                  MIDDLEWARE = [
                      'django.middleware.security.SecurityMiddleware',
                      'django.middleware.common.CommonMiddleware',
                      'django.middleware.csrf.CsrfViewMiddleware',
                      'django.contrib.auth.middleware.AuthenticationMiddleware',
                      'django.contrib.sessions.middleware.SessionMiddleware',
                      'django.contrib.messages.middleware.MessageMiddleware',
                      'django.middleware.clickjacking.XFrameOptionsMiddleware',
                  ]
                  

                  错误信息:

                  Warnings
                  ?: (1_7.W001) Middleware_Classes is not set.
                      Hint: Django 1.7 changed the global defaults for the middleware_classes. django.contrib.auth.middleware.AuthenticationMiddleware, django.contrib.sessions.middleware.SessionMiddleware, and django.contrib.messages.middleware.MessageMiddleware, were removed from the defaults. If your project needs this middleware then you should configure this middleware.
                  

                  推荐答案

                  MIDDLEWARE 设置是在 Django 1.10 中引入的.如果您使用的是 Django 1.9 或更早版本,它将无效,您应该改用 MIDDLEWARE_CLASSES 设置.

                  The MIDDLEWARE setting was introduced in Django 1.10. If you are using Django 1.9 or earlier it will have no effect, and you should be using the MIDDLEWARE_CLASSES setting instead.

                  确保您使用的是正确版本的文档(例如 Django 1.8,Django 1.11),以便您遵循正确的说明.

                  Make sure you are using the correct version of the docs (e.g. Django 1.8, Django 1.11), so that you follow the correct instructions.

                  这篇关于Django 中间件错误 - 为 1.7 更改了中间件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)
                    <tbody id='vUaAW'></tbody>
                • <small id='vUaAW'></small><noframes id='vUaAW'>

                • <tfoot id='vUaAW'></tfoot>
                  <i id='vUaAW'><tr id='vUaAW'><dt id='vUaAW'><q id='vUaAW'><span id='vUaAW'><b id='vUaAW'><form id='vUaAW'><ins id='vUaAW'></ins><ul id='vUaAW'></ul><sub id='vUaAW'></sub></form><legend id='vUaAW'></legend><bdo id='vUaAW'><pre id='vUaAW'><center id='vUaAW'></center></pre></bdo></b><th id='vUaAW'></th></span></q></dt></tr></i><div id='vUaAW'><tfoot id='vUaAW'></tfoot><dl id='vUaAW'><fieldset id='vUaAW'></fieldset></dl></div>
                  <legend id='vUaAW'><style id='vUaAW'><dir id='vUaAW'><q id='vUaAW'></q></dir></style></legend>

                    • <bdo id='vUaAW'></bdo><ul id='vUaAW'></ul>