找不到模块django.contrib.auth.context_processors

时间:2014-02-03 18:00:34

标签: python django eclipse

当我的django代码到达时:

res = render_to_response ('server_form.html', {'items':items}, context_instance =  RequestContext(request),)

我从浏览器中获得以下输出。为什么? 令人担忧的部分是这只发生在我安装dajax / dajaxice之后,直到那时一切正常。我确实难以让dajaxice工作,所以我可能会打扰一些事情,但问题是改变了什么来解决这个问题?据我所知,settings.py是正确的。我已经搜索了几天没有成功的解决方案,所以任何帮助解决这个问题最受欢迎。我在Eclipse Indigo下运行它。文件系统中的位置是/应该是ubuntu下的django.contrib.auth吗?

来自网络浏览器的输出:

Error importing request processor module django.contrib.auth.context_processors: "No module named context_processors"Request Method:    GET
Request URL:    http://x.x.x.x:8000/helloServ
Exception Type: ImproperlyConfigured
Exception Value:    Error importing request processor module django.contrib.auth.context_processors: "No module named context_processors"
Exception Location: /usr/lib/pymodules/python2.6/django/template/context.py in get_standard_processors, line 84
Python Executable:  /usr/bin/python2.6
Python Version: 2.6.6
Python Path:    ['/home/pjr/workspace/mysite2/src/mysite2', '/home/pjr/bin/eclipse372/eclipse/plugins/org.python.pydev_2.7.5.2013052819/pysrc', '/home/pjr/workspace/mysite2/src', '/home/pjr/bin/eclipse372/eclipse/plugins/org.python.pydev_2.7.1.2012100913/pysrc', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode']
Server time:    Mon, 3 Feb 2014 17:26:11 +0000

1 个答案:

答案 0 :(得分:0)

您确定上下文处理器当前位于settings.py配置文件中吗? 应该有某个地方:

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.request",
)

如果这没有帮助,根据您的错误,您应该能够在/usr/lib/pymodules/python2.6/django/找到您的django源文件。

祝你好运。