我试图将python
flask
部署到azure
,但无法通过。我在Azure
上创建一个api服务
这是我的url
,它与python 3
https://textclassifier.azurewebsites.net/一起使用
然后我在visual studio
上创建了一个默认的flask
项目,在不更改任何代码的情况下,我直接单击publish。选择了我从门户网站创建的应用程序服务,发布在VS
输出中成功显示:
Adding file (TextClassifier\TestFlask__init__.py). Adding ACLs for path (TextClassifier) Adding ACLs for path (TextClassifier) Publish Succeeded. Web App was published successfully http://textclassifier.azurewebsites.net/ ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== ========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
但是,当我访问urlhttps://textclassifier.azurewebsites.net/home
时,浏览器显示:“您要查找的资源已被删除、名称已更改或暂时不可用”。在
我检查了/home是否路由到控制器
谁能帮帮我,我已经被困了好几天了。在
根据我的经验,你的问题是由azure应用程序python环境造成的。请参考我的工作步骤,看看错误是否仍然出现。在
正如您在Managing Python on Azure App Service中发现的,Azure应用程序服务为您提供了一个
site extension
。您可以在KUDU console
上安装包。在步骤1:创建azure web应用程序并添加扩展(这里是Python3.6.1 x64)
步骤2:发布您的
flask
项目并添加web.config
。在在web.config文件公司名称:
步骤3:切换到Kudu命令和命令
cd Python361x64
和touch get-pip.py
,通过编辑按钮将urlhttps://bootstrap.pypa.io/get-pip.py
复制到get-pip.py
中,然后运行python get-pip.py
来安装pip工具。在步骤4:通过
python -m pip install pyodbc
安装所需的任何软件包希望对你有帮助。有什么问题,请告诉我。在
相关问题 更多 >
编程相关推荐