URL: https://www.opennet.me/cgi-bin/openforum/vsluhboard.cgi
Форум: vsluhforumID8
Нить номер: 6507
[ Назад ]

Исходное сообщение
"Apache + Mod_wsgi + django"

Отправлено sapun , 11-Сен-09 11:17 
Добрый день! есть проблема! собрал и поставил mod_wsgi в Apache
прописал вирталхост
<VirtualHost 127.0.0.1:88>
AddHandler wsgi-script .wsgi
    ServerName anydomain.com
    WSGIDaemonProcess anydomain.com user=usrr group=usrr threads=1 processes=2
      WSGIScriptAlias / /home/usrr/www/l7front/l7front.wsgi
</VirtualHost>

содержимое l7front.wsgi

#!/usr/local/bin/python
import os, sys
import os.path

sys.path.append('/usr/local/lib/python2.5/site-packages/django')
sys.path.append('/home/gs_front/www/l7front')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.py'

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


Постоянно выкатывает ошибку 500 и вот эти строки в логах..

Traceback (most recent call last):
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 230, in __call__
    self.load_middleware()
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py", line 33, in load_middleware
  for middleware_path in settings.MIDDLEWARE_CLASSES:
File "/usr/local/lib/python2.5/site-packages/django/utils/functional.py", line 269, in __getattr__
  self._setup()
File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 40, in _setup
  self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 75, in __init__
  raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'settings.py' (Is it on sys.path? Does it have syntax errors?): No module named py


Содержание

Сообщения в этом обсуждении
"Apache + Mod_wsgi + django"
Отправлено sapun , 11-Сен-09 12:21 
>[оверквотинг удален]
>  for middleware_path in settings.MIDDLEWARE_CLASSES:
>File "/usr/local/lib/python2.5/site-packages/django/utils/functional.py", line 269, in __getattr__
>  self._setup()
>File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 40, in _setup
>  self._wrapped = Settings(settings_module)
>File "/usr/local/lib/python2.5/site-packages/django/conf/__init__.py", line 75, in __init__
>  raise ImportError, "Could not import settings '%s' (Is it on
>sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
>ImportError: Could not import settings 'settings.py' (Is it on sys.path? Does it
>have syntax errors?): No module named py

Решил проблему!
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'