简体   繁体   English

Django mod_wsgi错误

[英]Django mod_wsgi error

I have Django set up and working well on my local machine, and I'm now attempting to deploy it in a production environment with mod_wsgi . 我已经在本地计算机上设置了Django并在其上正常工作,现在我正尝试使用mod_wsgi在生产环境中部署它。 One variable is that locally I have Python 2.7.3 and in my production environment (EC2) I have Python 2.6.8, which is theoretically still compatible with Django 1.5. 一个变量是本地我有Python 2.7.3,在生产环境(EC2)中我有Python 2.6.8,从理论上讲它仍然与Django 1.5兼容。

I'm able to see the intro Django page and successfully ran ./manage.py startapp myapp and ./manage.py syncdb , but after restarting httpd and attempting to hit the site through my browser I receive a 500 error and the following shows up in my error_log : 我能够看到Django简介页面并成功运行./manage.py startapp myapp./manage.py syncdb ,但是重新启动httpd并尝试通过浏览器访问该网站后,我收到500错误,并显示以下内容在我的error_log

mod_wsgi (pid=7852): Exception occurred processing WSGI script '/path/to/my/django.wsgi'.
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 236, in __call__
    self.load_middleware()
  File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 59, in load_middleware
    mw_instance = mw_class()
TypeError: auth() takes exactly 1 argument (0 given)

My settings are, for all intents and purposes, identical to those in my local environment (save the DEBUG flag, etc.). 出于所有意图和目的,我的设置与我的本地环境中的设置相同(保存DEBUG标志等)。 I'm unable to find out where the configuration issue is. 我无法确定配置问题在哪里。 I personally find the Django documentation rather poor for deployment and not too many others have run into this particular wall. 我个人发现Django文档非常不适合部署,并且没有太多其他人碰到过这堵墙。

I'm happy to give more detail if needed. 如果需要,我很乐意提供更多细节。

I fume when this happens, but I found the issue moments after posting this. 当发生这种情况时,我会发烟,但是在发布此消息后发现了问题的片刻。 I had a line in settings.py under the middleware section that was pointing to the auth context processor and not a middleware module. 我在中间件部分的settings.py有一行,它指向auth上下文处理器,而不是中间件模块。 I removed it and all is well. 我删除了它,一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM