Настройка Django WSGI Centos5,5 - PullRequest
       17

Настройка Django WSGI Centos5,5

2 голосов
/ 11 июня 2011

При попытке подключиться через браузер к моему приложению 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>

1 Ответ

2 голосов
/ 11 июня 2011

1001 * попробовать *

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

(Вам не хватает скобок.)

...