Python中文
首页
教程
问答
标签
搜索
登录
注册
Django RemoteUserMiddleware RemoteUserBackend与新数据库的帮助
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>Django的1.3版本包括<code>RemoteUserMiddleware</code>和 <code>RemoteUserBackend</code>类来允许Apache进行身份验证。 见<a href="http://docs.djangoproject.com/en/dev/howto/auth-remote-user/" rel="nofollow">http://docs.djangoproject.com/en/dev/howto/auth-remote-user/</a></p> <p>我有首字母_数据.json它在执行syncdb时创建一个超级用户。dumpdata证实了这一点。在</p> <p>但是我发现它似乎不能用新创建的数据库正确登录。我得到一个未配置的异常,它说: Django远程用户身份验证中间件需要安装身份验证中间件。在</p> <pre><code>Edit your MIDDLEWARE_CLASSES setting to insert django.contrib.auth.middleware.AuthenticationMiddleware' before the RemoteUserMiddleware class. </code></pre> <p>回溯指向<code>RemoteMilddleware.process_request()</code>:</p> ^{pr2}$ <p>Apache的调试输出显示,设置实际上按请求的顺序有<code>AuthenticationMiddleware</code>和{<cd1>}:</p> <pre><code>MIDDLEWARE_CLASSES ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.RemoteUserMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') </code></pre> <p>但是请求.用户属性未设置,生成异常。在</p> <p>如果我仔细看看django.contrib.auth公司.后端和中间件, 我发现<code>AuthenticationMiddleware</code>正在为注册<code>LazyUser</code> 请求类。但是<code>RemoteUserBackend</code>似乎没有 调用authenticate()方法,远程用户在Users表中查找该方法。在</p> <p>我需要做些什么来让<code>authenticate()</code>被调用以便创建请求.user?在</p> <p>我可以根据需要提供更多信息。顺便说一下,这是使用SSL。有没有一些我没料到的互动?在</p> <p>我应该提到我使用的是Apache2.2.14和<code>mod_wsgi</code>。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我也遇到了同样的问题,经过一点调试,我发现我忘了为auth和其他应用创建mysql表(我认为sqllite也是这样)。所以如果你没有,你需要运行python管理.py或者用其他方法创建它们</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
2 回答
无法使用Django\u mssql\u后端迁移到外部hos
8 回答
无法使用Django&Python3.4连接到MySql
8 回答
无法使用Django+nginx上载媒体文件
4 回答
无法使用Django1.6导入名称模式
3 回答
无法使用Django1.7和mongodb登录管理站点
6 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
1 回答
无法使用Djangockedi验证CBV中的字段
9 回答
无法使用Djangocketditor上载图像(错误400)
6 回答
无法使用Djangocron进行函数调用
5 回答
无法使用Djangofiler djang上载文件
5 回答
无法使用Djangokronos
7 回答
无法使用Djangomssql provid
4 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
5 回答
无法使用Djangomssq迁移Django数据库
6 回答
无法使用Djangonox创建用户
6 回答
无法使用Djangopyodb从Django查询SQL Server
6 回答
无法使用Djangopython3ldap连接到ldap
7 回答
无法使用Djangoredis连接到redis
6 回答
无法使用Django中的FK创建新表
2 回答