【问题标题】:Django wsgi setup centos5.5Django wsgi 设置 centos5.5
【发布时间】:2011-09-12 20:20:00
【问题描述】:

在尝试通过浏览器连接到我的 django 应用时,我遇到了以下异常(在 var/log/httpd/error_log 中):

[Fri Jun 10 18:02:03 2011] [error] [client 167.206.188.3] mod_wsgi (pid=3550): Exception occurred processing WSGI script '/var/www/cgi-bin/django.wsgi'.
[Fri Jun 10 18:02:03 2011] [error] [client 167.206.188.3] TypeError: __init__() takes exactly 1 argument (3 given)
[Fri Jun 10 18:02:04 2011] [error] [client 167.206.188.3] mod_wsgi (pid=3551): Exception occurred processing WSGI script '/var/www/cgi-bin/django.wsgi'.
[Fri Jun 10 18:02:04 2011] [error] [client 167.206.188.3] TypeError: __init__() takes exactly 1 argument (3 given)

这是/var/www/cgi-bin/django.wsgi的内容:

import os
import sys

paths = ['/usr/lib/python2.6/site-packages/', '/usr/lib/python2.6/site-packages/django/', '/usr/lib/python2.6/site-packages/django/reuters' ]
for path in paths:
    if path not in sys.path:
        sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE']='reuters.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler

以及内容:/etc/httpd/conf.d/python26-mod_wsgi.conf:

<IfModule !python_module>
    <IfModule !wsgi_module>
        LoadModule wsgi_module modules/python26-mod_wsgi.so
        WSGIPythonEggs /var/www/.python-eggs/
    </IfModule>
</IfModule>

<VirtualHost *:80>
    Alias /static /usr/lib/python2.6/site-packages/django/reuters/rca/static

    # WSGI Settings
    WSGIScriptAlias / /var/www/cgi-bin/django.wsgi

    <Directory "/var/www/cgi-bin">
        # Allow Apache to follow links
        Options FollowSymLinks
        # Turn on the ability to use .htaccess files
        AllowOverride All
        # Controls who can get stuff from this directory
        Order allow,deny
        Allow from all
    </Directory>

    <Directory "/usr/lib/python2.6/site-packages/django/reuters/rca/static">
        # Allow Apache to follow links
        Options FollowSymLinks
        # Turn on the ability to use .htaccess files
        AllowOverride All
        # Controls who can get stuff from this directory
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

【问题讨论】:

    标签: django mod-wsgi python-2.6


    【解决方案1】:

    试试

    application = django.core.handlers.wsgi.WSGIHandler()
    

    (您缺少括号。)

    【讨论】:

      猜你喜欢
      • 2017-01-22
      • 1970-01-01
      • 2010-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-07
      • 1970-01-01
      相关资源
      最近更新 更多