尝试为烧瓶python创建azure python Web应用程序,但出现以下错误
<httpRuntime targetFramework="4.6.1" requestValidationMode="4.5" executionTimeout="36000" />
StdOut:
StdErr:
我尝试将wfastcgi升级,之后我将脚本位置更改为新的wfastcgi,这是在抛出脚本处理程序scriptProcessor时找不到错误
文件夹结构:
Error occurred while reading WSGI handler:
Traceback (most recent call last): File "D:\Python34\Scripts\wfastcgi.py", line 711, in main
env, handler = read_wsgi_handler(response.physical_path) File "D:\Python34\Scripts\wfastcgi.py", line 568, in read_wsgi_handler
return env, get_wsgi_handler(handler_name) File "D:\Python34\Scripts\wfastcgi.py", line 551, in get_wsgi_handler
raise ValueError('"%s" could not be imported' % handler_name) ValueError: "hostingstart.app" could not be imported
hostingstart.py
WWWroot
- hostingstart.py
- view.py
- web.config
Web.Config
from flask import Flask
app = Flask(__name__)
import view
wsgi_app = app.wsgi_app
答案 0 :(得分:0)
您可以按照以下步骤尝试安装python extension version
,而不要使用Azure Web App自带版本。
第1步:添加扩展(这里是Python 3.6.1 x64)
第2步:发布您的flask
项目并添加web.config
。
web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="<Your Project Name>.app"/>
<add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
<add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
</appSettings>
<system.webServer>
<handlers>
<add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\Python361x64\python.exe|D:\home\Python361x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
</handlers>
</system.webServer>
</configuration>
如果部署成功,您将在KUDU
路径中看到以下结构:D:\home\site\wwwroot>
。
如果要使用其他python软件包,请继续。
第3步:切换到Kudu CMD并命令cd Python361x64
和touch get-pip.py
,然后通过“编辑”按钮将网址https://bootstrap.pypa.io/get-pip.py
的内容复制到get-pip.py
中,然后运行{ {1}}安装点子工具。
第4步:通过python get-pip.py