如何在Azure上运行基于python3.7的Flask Web API [英] How to run python3.7 based flask web api on azure
问题描述
我正在尝试在Azure Web应用程序上托管我的python API.这是一个基于Flaks的应用程序,并具有一个演示烧瓶代码.我已经创建了资源组并设置了所有内容.但是访问网址时会显示
I am trying to host my python api on azure web app. It is a Flaks based application and having a demo flask code . I have created resource group and setup everything. But when accessing the url it shows
虽然我可以从部署选项中看到,但它已经成功部署了我的bitbucket项目.我在应用程序设置中选择了python3.4版本.我尝试添加最新的python扩展名,但仅提供3.6version.我添加了python3.6扩展名,但它仍仅在应用程序设置中显示python3.4.
although I can see from the deployment options, it has successfully deployed my bitbucket project. I have selected python3.4 version in the application settings. I have tried adding the latest python extension but only 3.6version is available. I have added the python3.6 extension but it still only show python3.4 in application settings.
我不知道该如何解决此问题.请帮忙.谢谢.
I do not know how can I resolve this issue. Please help. Thanks.
推荐答案
S Andrew.
web.config
文件对于Web应用程序的部署至关重要.您可以在KUDU网址上创建web.config文件.
web.config
file is essential in the deployment of your web App.You could create the web.config file on the KUDU url.
您可以通过以下两种方式导航到KUDU:
You could navigate to KUDU via below two way:
1.找到门户上的按钮.
1.Find the button on the portal.
2.access网址直接:https://.scm.azurewebsites.net/
2.access url directly: https://.scm.azurewebsites.net/
在KUDU上,您可以在以下路径中看到您的应用程序结构:D:\home\site\wwwroot
,您需要在此处创建web.config
文件.
On the KUDU,you could see your app structure in the path: D:\home\site\wwwroot
,you need to create web.config
file here.
此外,您还可以在以下路径中看到python扩展名:D:\home\
,如果要使用扩展名环境,则需要在web.config
中配置正确的路径.
Also,you could see your python extension in the path:D:\home\
, if you want to use extension environment, you need to configure the correct path in web.config
.
请参阅我的示例web.config
文件.与web.config
相关,您可以参考此
Please see my sample web.config
file.Related to web.config
, you could refer to this official doc.
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="<your app 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>
有关Azure上python应用程序部署的更多详细信息,请查看我以前的案例,您将找到答案.
More details about python app deployment on the azure,please see my previous cases,you will find the answer.
2.在上部署python flask项目使用Visual Studio蔚蓝
希望它对您有帮助.
这篇关于如何在Azure上运行基于python3.7的Flask Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!