Lion (Mac OS X 10.7.3)을 실행중인 iMac에서 Python 2.7, Apache, mod_wsgi 및 web2py를 사용하여 웹 개발 환경을 설정하려고합니다. Exec 형식 오류 : Mac OS X Lion의 apache + mod_wsgi
나는 다운로드 mod_wsgi에 V 3.3 설치. (./configure 실행을, 만들기, sudo를 설치하게) 그것은는/usr/libexec 디렉토리/아파치를 설치. 모든 분별 같습니다
07:49 PM ~ [541] otool -L /usr/libexec/apache2/mod_wsgi.so
/usr/libexec/apache2/mod_wsgi.so:
/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.19.0)
07:55 PM ~ [542] file /usr/libexec/apache2/mod_wsgi.so
/usr/libexec/apache2/mod_wsgi.so: Mach-O universal binary with 2 architectures
/usr/libexec/apache2/mod_wsgi.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
/usr/libexec/apache2/mod_wsgi.so (for architecture i386): Mach-O bundle i386
내가 모든을 LoadModule 지시어 후 /private/etc/apache2/httpd.conf 여러 설정 지시어를 추가했다.
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
WSGIScriptAlias//Library/WebServer/Documents
아파치 데몬을 다시 시작했습니다.
[공지] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 mod_wsgi/3.3 Python/2.7.2 구성 - 다시 시작 정상 작동
나는/라이브러리/웹 서버/문서 폴더에이 파일을 넣어
: 나는 내 브라우저에서 실행def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
내가 돌아왔다 "500 내부 서버 오류"응답
내 서버 로그는 말한다 :
[Thu Feb 09 20:12:10 2012] [error] [client 192.168.1.2] (8)Exec format error: exec of '/Library/WebServer/Documents/test.py' failed
[Thu Feb 09 20:12:10 2012] [error] [client 192.168.1.2] Premature end of script headers: test.py
[Thu Feb 09 20:12:10 2012] [error][client 192.168.1.2] mod_wsgi (pid=4251): Target WSGI script '/Library/WebServer/Documents/favicon.ico' does not contain WSGI application 'application'.
많이 검색 한 후 나는 이유를 찾을 수가있다. 나는 심지어 문서 폴더에 favicon.ico를 붙였습니다. 이로 인해 기록이 남았습니다.
[Thu Feb 09 19:15:44 2012] [error] [client 192.168.1.2] (8)Exec format error: exec of '/Library/WebServer/Documents/test.py' failed
[Thu Feb 09 19:15:44 2012] [error] [client 192.168.1.2] Premature end of script headers: test.py
[Thu Feb 09 19:15:46 2012] [error] [client 192.168.1.2] mod_wsgi (pid=4135): Target WSGI script '/Library/WebServer/Documents/favicon.ico' does not contain WSGI application 'application'.
아무 도움이됩니다.
이 간부 형식의 오류가 도망 갔어요! 파이썬 소스 파일의 시작 부분에. "아직 끝나지 않은 스크립트 끝"오류 또는 "대상 WSGI 스크립트에 WSGI 응용 프로그램 '응용 프로그램이 없습니다."파일 사용 권한 (755) 및 인코딩 (UTF-8)을 확인했습니다. – david193
왜 mod_python을 제목에 넣으시겠습니까? –