2
python 기반 웹 응용 프로그램을 완전히 새롭게 했으므로 다소 분실했습니다.WSGI, Flask 및 Apache에서 오류 가져 오기
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] mod_wsgi (pid=23704): Target WSGI script '/home/http/public/hello/hello.wsgi' cannot be loaded as Python module.
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] mod_wsgi (pid=23704): Exception occurred processing WSGI script '/home/http/public/hello/hello.wsgi'.
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] Traceback (most recent call last):
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] File "/home/http/public/hello/hello.wsgi", line 3, in <module>
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] from hello import app as application
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] File "/home/http/public/hello/hello.py", line 1, in <module>
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] from flask import Flask
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] ImportError: No module named 'flask'
[Wed May 08 22:41:47 2013] [error] [client 64.56.91.45] File does not exist: /home/http/public/favicon.ico
분명히, 그것은 flask
모듈을 찾을 수 없습니다 : 여기 내 아파치 오류입니다. 나는이를 검토 한 결과, 대부분의 사람들이 그렇게 같은 경로를 프로젝트 디렉토리를 추가하여 작동하도록 보인다 : 여기 (hello.wsgi)
import sys
sys.path.insert(0, "/home/http/public/hello")
from hello import app as application
및 hello.py입니다 :
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run(host='0.0.0.0')
python hello.py
으로 실행했을 때 훌륭하게 작동하지만 host/hello로 이동할 때 500 오류가 발생합니다. 다음은 Apache 구성입니다.
WSGIDaemonProcess hello user=http group=http threads=5
WSGIScriptAlias /hello "/home/http/public/hello/hello.wsgi"
<Directory /home/http/public/hello/>
WSGIProcessGroup hello
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
다소 길입니다.
은 어떻게 플라스크를 설치 않은가? Virtualenv에 있습니까? – SingleNegationElimination
pip를 통해 플라스크를 설치하십시오 :'''pip2 설치 플라스크''' – Ryan
얼마나 많은 파이썬 버전/설비가 있습니까? mod_wsgi는 패키지를 설치할 위치와 다른 버전에 대해 빌드 된 것 같습니다. –