'WSGIRequest' object has no attribute 'user'
2015-08-27 18:11
639 查看
From: http://stackoverflow.com/questions/26576192/wsgirequest-object-has-no-attribute-user
I'am trying to make an auth module in my django project. But when I open my web site url I have a this error: 'WSGIRequest' object has no attribute 'user'
I've trying to find information about this problem and somebody said that the problem is in MIDDLEWARE_CLASSES but I can't understand it.
This is my MIDDLEWARE_CLASSES:
Answer:
Your middleware ordering is wrong. Please read
this part carefully.The order should be:
I'am trying to make an auth module in my django project. But when I open my web site url I have a this error: 'WSGIRequest' object has no attribute 'user'
I've trying to find information about this problem and somebody said that the problem is in MIDDLEWARE_CLASSES but I can't understand it.
This is my MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', #'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', )
Answer:
Your middleware ordering is wrong. Please read
this part carefully.The order should be:
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
相关文章推荐
- Objective-C 【关于导入类(@class 和 #import的区别)】
- Objective-C 【关于导入类(@class 和 #import的区别)】
- objective-c知识点易混点总结
- Object Graph Serialization
- iOS开发(Objective-C)常用库索引
- Objective-C的可变是如何实现的?
- Objective-C之run loop详解
- UML之对象图(Object Diagram)
- 堆栈 Objective-C NSString copy strong
- tfmxobject的序列化
- 【原创】获取指定index的 OBJECTTYPE
- JSONObject.fromObject问题
- Objective-C JSON操作
- Java____java.lang.object
- OC基础回顾(十四)文件加载与保存
- 线程中CreateEvent和SetEvent及WaitForSingleObject的用法
- objective-c 方法加号(+) 减号(-)
- Java IO流->处理流->对象流:ObjectOutputStream&ObjectInputStream
- DSO Framer Control Object 操作word文件
- 详谈OC(object-c)深浅复制/拷贝-什么情况下用retain和copy