2011-06-10 51 views
2

雖然試圖通過瀏覽器連接到我的Django應用程序,我發現了以下情況除外(在無功/日誌/的httpd/error_log中):Django的WSGI安裝centos5.5

[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> 

回答

2

嘗試

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

(您錯過的括號內。)