2009-03-13 1 views
0

나는 잠시 지금 mod_python을 실행 장고 있었다 그러나 오늘 나는 다음과 같은 오류를 얻을장고 mod_python의 오류

MOD_PYTHON ERROR 

ProcessId:  4551 
Interpreter: 'thatch' 

ServerName:  'thatch' 
DocumentRoot: '/var/www/thatch' 

URI:   '/' 
Location:  '/' 
Directory:  None 
Filename:  '/var/www/thatch/' 
PathInfo:  '' 

Phase:   'PythonHandler' 
Handler:  'django.core.handlers.modpython' 

Traceback (most recent call last): 

    File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch 
    default=default_handler, arg=req, silent=hlist.silent) 

    File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1202, in _process_target 
    module = import_module(module_name, path=path) 

    File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 304, in import_module 
    return __import__(module_name, {}, {}, ['*']) 

ImportError: No module named django.core.handlers.modpython 

이 내 가상 호스트 설정

<VirtualHost *:80> 
    ServerName thatch 

    DocumentRoot /var/www/thatch 

    <Location "/"> 
    SetHandler python-program 
    PythonPath "['/var/www/thatch'] + sys.path" 
    PythonHandler django.core.handlers.modpython 
    SetEnv DJANGO_SETTINGS_MODULE thatch.settings 
    PythonOption django.root /var/www/thatch 
    PythonDebug On 
    </Location> 

    <Location "/media"> 
    SetHandler None 
    </Location> 

    <LocationMatch "\.(jpg|gif|png|css|js)$"> 
    SetHandler None 
    </LocationMatch> 

</VirtualHost> 

어떤 아이디어 이런 일이 왜?

+0

당신이 django.core를 가져올 수 있습니다. 수동으로 파이썬 셸에서 handlers.modpython? 내 파이썬 모듈 가져 오기 실패 할 때 이런 이상한 가져 오기 문제가 실행 된 있지만 수동으로 가져 오기 시도하여 더 많은 설명 오류가 종종 있습니다. –

+0

예 쉘에서 직접 가져올 수 있습니다. –

+0

그렇다면 Apache에서 파이썬 경로는 어떻게됩니까? 시스템 전체 경로에서 변경된 경우 일 수 있습니다. 이를 테스트하기 위해 PythonPath를 사용하여 Django에 대한 경로를 명시 적으로 추가 할 수 있습니다. –

답변

1

난 단지 당신의 문제가 무엇인지 추측 할 수 있지만, 여기에 두 개의 표준 검사입니다 : 쉘에서

  1. 가져 오기 modpython 다른 작업 디렉토리는 몇에서,
  2. 변경 사용자 (어떤 루트 외에있는 경우 단계보다 가치 # 2 더 많은 문제처럼 보인다면 1

, 다음 아주, 경로를 따라 각 폴더에 대해 매우 신중하게 검사 권한이 있는지 확인 modpython하려고 설정) 반복 "기타"는 도중에 모든 단계에서 읽기 액세스 권한을가집니다. django를 홈 디렉토리로 이동 한 경우 (한 번 ... 왜 그런지는 모르지만 같은 오류가 있음) 문제가됩니다. 아파치가 읽을 수있는 디렉토리로 다시 이동하거나 다른 디렉토리에 대한 읽기 권한을 추가해야합니다.

0

제 경우에는 pytonpath와 액세스 권한이 괜찮습니다. 이 오류는 재 컴파일 파이썬 후에 사라졌습니다.

구성 :
젠투
장고 1.1
아파치 :
WWW-서버/아파치 2.2.15 = "문서의 SSL suexec를 스레드 -debug -ldap (-selinux) -static"APACHE2_MODULES = "별명 사용 auth_basic authn_alias authn_anon authn_default authn_file authz_default authz_host authz_owner 자동 색인 캐시 DAV dav_fs dav_lock 수축 디렉토리 disk_cache ENV ext_filter의 file_cache 필터 헤더 LOG_CONFIG에서 LogIO mem_cache는 스펠링 상태한다 SetEnvIf mime_magic 협상 재 작성을 마임 정보를 포함 만료 UNIQUE_ID 또, Userdir usertrack vhost_alias -actions -asis -auth_digest -authn_dbd -authn_dbm -authz_dbm -authz_groupfile -authz_user -cern_meta -charset_lite -dbd -dumpio -ident -ima gemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version "APACHE2_MPMS ="노동자 -event -itk -peruser -prefork "
파이썬 2.6.4