플라스크 서버를 실행하기 위해 virtualenv를 설정했습니다. 나는 iis와 함께 일할 wfastcgi를 설정하는 단계를 따라 갔다. 그것은 파이썬 애플 리케이션에 액세스 할 수있는 것처럼 작동하고있는 것 같지만 파이썬 오류 스택이 인쇄됩니다.wfastcgi virtualenv가있는 IIS에 Flask App - 패키지를 찾을 수 없음
Traceback (most recent call last):
File "c:\python27\lib\site-packages\wfastcgi.py", line 793, in main
env, handler = read_wsgi_handler(response.physical_path)
File "c:\python27\lib\site-packages\wfastcgi.py", line 635, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "c:\python27\lib\site-packages\wfastcgi.py", line 618, in get_wsgi_handler
raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "flask_app.application()" could not be imported: Traceback (most recent call last):
File "c:\python27\lib\site-packages\wfastcgi.py", line 602, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File ".\flask_app.py", line 7, in <module>
from app import app as application
File ".\app\__init__.py", line 67, in <module>
from flask_restless import APIManager
ImportError: No module named flask_restless
나는 이것이 내가 flask_restless를 설치 한 방법과 관련이있다 생각 : WSGI 핸들러를 읽는 동안
오류가 발생했습니다.
pip install -e git://github.com/jfinkels/flask-restless.git#egg=flask_restless
을 사용하여 설치했는데, Lib/site-packages 디렉토리에 flask_restless를 추가하지 않은 것으로 보입니다. 하지만 그 수동으로 애플 리케이션을 실행할 때 문제가되지 않습니다.
여기 내 Web.config의의 :
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python27\python.exe|C:\Python27\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="flask_app.application()" />
<add key="PYTHONPATH" value="C:\www\flask_app\virtualenv\src;C:\www\flask_app\virtualenv\Lib\site-packages;C:\www\flask_app\app" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\inetpub\logs\wsgi.log" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
</appSettings>
</configuration>
다음과 같이 내 flask_app.py은 다음과 같습니다
this_file = 'C:/www/flask_app/virtualenv/Scripts/activate_this.py'
with open(this_file) as f:
code = compile(f.read(), this_file, 'exec')
exec(code)
from app import app as application
내가 주 동안 고민 했어요 문제 해결 설정을. 고맙습니다! – Ari