如何在 azure 上运行基于 python3.7 的烧瓶 web api [英] How to run python3.7 based flask web api on azure

查看:27
本文介绍了如何在 azure 上运行基于 python3.7 的烧瓶 web api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的 python api 托管在 azure web 应用程序上.它是一个基于 Flaks 的应用程序,并有一个演示烧瓶代码.我已经创建了资源组并设置了所有内容.但是在访问 url 时会显示

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.6 版本可用.我已经添加了 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 url 上创建 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.直接访问url:https://.scm.azurewebsites.net/

2.access url directly: https://.scm.azurewebsites.net/

在KUDU上,你可以在路径中看到你的应用结构:D:homesitewwwroot,你需要在这里创建web.config文件.

On the KUDU,you could see your app structure in the path: D:homesitewwwroot,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:homesitewwwroot"/>
    <add key="WSGI_LOG" value="D:homeLogFileswfastcgi.log"/>
  </appSettings>
  <system.webServer>
    <handlers>
      <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:homePython361x64python.exe|D:homePython361x64wfastcgi.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.

1.未能将 Flask 部署到 Azure

2.部署python烧瓶项目天蓝色使用视觉工作室

希望对你有帮助.

这篇关于如何在 azure 上运行基于 python3.7 的烧瓶 web api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆