2012-02-28 13 views
1

mod_wsgiを使用してmod_auth_sspiによってシングルサインオンが有効になっているDjangoアプリケーションを1つ実行しました。mod_auth_sspiとmod_wsgiを使ってApacheで2つのDjangoアプリケーションを実行する

のApache/2.2.21(Win32の)のmod_wsgi/3.3のPython/2.7.2 mod_auth_sspi/1.0.4

ので、私の問題は、私は同じモジュールを使用する第2のDjangoアプリケーションを追加できないこと、ですシングルサインオンを使用する場合もあります。 2番目のアプリを追加すると、Apacheは最初にリクエストされたアプリのみを認証します。 2番目のエラー500 - 内部サーバーエラーがスローされます。 Apacheを再起動して、最初に2番目のアプリをリクエストしようとすると、正常に動作します。しかし、最初のアプリケーションをリクエストすると、エラー500(最初のエラーと同じエラー)がスローされます。

Error.logです:

mod_wsgi (pid=4724): Exception occurred processing WSGI script 'C:/www/app2/app2.wsgi'. 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] Traceback (most recent call last): 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\handlers\\wsgi.py", line 272, in __call__ 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  response = self.get_response(request) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\handlers\\base.py", line 169, in get_response 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\handlers\\base.py", line 203, in handle_uncaught_exception 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return debug.technical_500_response(request, *exc_info) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\views\\debug.py", line 59, in technical_500_response 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  html = reporter.get_traceback_html() 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\views\\debug.py", line 151, in get_traceback_html 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return t.render(c) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 123, in render 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return self._render(context) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 117, in _render 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return self.nodelist.render(context) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 744, in render 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  bits.append(self.render_node(node, context)) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\debug.py", line 73, in render_node 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  result = node.render(context) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\debug.py", line 90, in render 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  output = self.filter_expression.resolve(context) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 536, in resolve 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  new_obj = func(obj, *arg_vals) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\defaultfilters.py", line 695, in date 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return format(value, arg) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 285, in format 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return df.format(format_string) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 30, in format 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  pieces.append(force_unicode(getattr(self, piece)())) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 191, in r 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return self.format('D, j M Y H:i:s O') 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 30, in format 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  pieces.append(force_unicode(getattr(self, piece)())) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\encoding.py", line 71, in force_unicode 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  s = unicode(s) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\functional.py", line 206, in __unicode_cast 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return self.__func(*self.__args, **self.__kw) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\__init__.py", line 81, in ugettext 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return _trans.ugettext(message) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 286, in ugettext 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  return do_translate(message, 'ugettext') 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 276, in do_translate 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  _default = translation(settings.LANGUAGE_CODE) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 185, in translation 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  default_translation = _fetch(settings.LANGUAGE_CODE) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 162, in _fetch 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  app = import_module(appname) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\importlib.py", line 35, in import_module 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  __import__(name) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\contrib\\admin\\__init__.py", line 3, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\contrib\\admin\\helpers.py", line 3, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  from django.contrib.admin.util import (flatten_fieldsets, lookup_field, 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\contrib\\admin\\util.py", line 1, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  from django.db import models 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\db\\models\\__init__.py", line 12, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  from django.db.models.fields.files import FileField, ImageField 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\db\\models\\fields\\files.py", line 9, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  from django.core.files.storage import default_storage 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\files\\storage.py", line 9, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  from django.core.files import locks, File 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\files\\locks.py", line 25, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  import pywintypes 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 124, in <module> 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  __import_pywin32_system_module__("pywintypes", globals()) 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] File "C:\\Python\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 114, in __import_pywin32_system_module__ 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]  assert sys.modules[modname] is old_mod 
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] TemplateSyntaxError: Caught AssertionError while rendering: 

CONF/wsgi.conf:

WSGIScriptAlias /app1 "C:/www/app1/app1.wsgi" 

<Directory "C:/www/app1"> 
    Allow from all 
# AllowOverride AuthConfig 
</Directory> 

<Location /app1> 
    AuthName "server" 
    AuthType SSPI 
    SSPIAuth On 
    SSPIAuthoritative On 
    SSPIUsernameCase lower 
# SSPIDomain DOMAIN 
    require valid-user 
</Location> 

WSGIScriptAlias /app2 "C:/www/app2/app2.wsgi" 

<Directory "C:/www/app2"> 
    Allow from all 
# AllowOverride AuthConfig 
</Directory> 

<Location /app2> 
    AuthName "server" 
    AuthType SSPI 
    SSPIAuth On 
    SSPIAuthoritative On 
    SSPIUsernameCase lower 
# SSPIDomain DOMAIN 
    require valid-user 
</Location> 

Alias /static/ "c:/static-root/" 
<Directory "c:/static-root/"> 
    Order Allow,Deny 
    Allow from all 
</Directory> 

C:/www/app2/app2.wsgi(app1.wsgiが類似している):

import os 
import sys 

path = 'c:/www/' 
apps_path = 'c:/www/app2/' 
if path not in sys.path: 
    sys.path.append(path) 
if apps_path not in sys.path: 
    sys.path.append(apps_path) 

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

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

両方のアプリケーションをシングルサインオンで使用するにはどうすればよいですか?私はそれがDjangoのfault、mod_wsgi faultまたはmod_auth_sspi faultなら、わかりません。私を助けてくれますか?

EDIT: mod_auth_sspiモジュールに依存しないように見えます。

答えて

2

それはpywin32エラーのように見える、ここで答え: Multiple django sites on Apache/Windows/mod_wsgi - problem with win32

をモジュールで何かをして、上げるいくつかのPythonのバージョンチェックが、あります:

AssertionError: assert sys.modules[modname] is old_mod 

バグが報告されますが、解決されません:

https://sourceforge.net/tracker/?func=detail&aid=2905909&group_id=78018&atid=551954

https://sourceforge.net/tracker/?func=detail&aid=3496224&group_id=78018&atid=551954

一時的な解決策はのwin32/libに2行をコメントアウトしている/ pywintypes.py

if sys.version_info < (3,0): 
    #next two lines are problematic!!!!! 
    #assert sys.modules[modname] is old_mod 
    #assert mod is old_mod 
    pass 
else: 
    assert sys.modules[modname] is not old_mod 
    assert sys.modules[modname] is mod 
    # as above - re-reset to the *old* module object then update globs. 
    sys.modules[modname] = old_mod 
    globs.update(mod.__dict__) 
関連する問題