[英]Deploying Python Flask on Azure Get error 500
In the following hour's i tried to deploy Python with flask on Microsoft azure platform. 在接下来的一个小时里,我尝试在Microsoft azure平台上将Python与flask一起部署。
I used New app "flask", assign with their server. 我使用了新的应用程序“ flask”,并为其分配了服务器。 deployed by git. 由git部署。 after deployment finished (its showed Unable to find vcvarsall.bat) Then I set up on options that i am using python 3.4 version and it fixed it up. 部署完成后(它显示无法找到vcvarsall.bat),然后设置了我正在使用python 3.4版本的选项,并对其进行了修复。
After Deployment succeeds I tried to see the site and I got : Failed to load resource: the server responded with a status of 500 (Internal Server Error) 部署成功后,我尝试查看该站点,但我得到:加载资源失败:服务器响应,状态为500(内部服务器错误)
I am a beginner in deploying and I search up all over. 我是部署的初学者,我到处搜索。 I really wish somebody could help me find the right answer. 我真的希望有人能帮助我找到正确的答案。
Thank you very much. 非常感谢你。
Based on my research on this blog which mentioned content below about your issue: 根据我对此博客的研究,该博客在下面提到了有关您的问题的内容:
When you see "unable to find vcvarsall.bat", it means you're installing a package that has an extension module, but only the source code. 当您看到“无法找到vcvarsall.bat”时,表明您正在安装的软件包具有扩展模块,但只有源代码。 "vcvarsall.bat" is part of the compiler in Visual Studio that is necessary to compile the module. “ vcvarsall.bat”是Visual Studio中编译器的一部分,对模块进行编译是必需的。
I think your issue occurred because that during the flask project deployed to azure, pip has problems installing the lxml
library.As mentioned in this document , lxml
library is written in C which requires a compiler before it's installation. 我认为发生您的问题是因为在将flask项目部署到azure期间,pip无法安装lxml
库。如本文档所述 , lxml
库是用C编写的,安装前需要编译器 。
Unfortunately,a compiler is not available on the machine running the web app in Azure App Service. 不幸的是,在Azure App Service中运行Web应用程序的计算机上没有编译器。 So, you need to do this compilation locally. 因此,您需要在本地进行此编译。 You can follow the steps as below: 您可以按照以下步骤操作:
Step 1 :Use pip wheel
command line to generate .whl
file of lxml
package.In addition,you can directly download generated .whl
file here . 第1步 :使用pip wheel
命令行生成lxml
包的.whl
文件。此外,您可以在此处直接下载生成的.whl
文件。
Step2 :Create the wheelhouse folder under the requments.txt file's sibling directory and put the .whl
file in wheelhouse folder. 步骤2 :在requments.txt文件的同级目录下创建wheelhouse文件夹,然后将.whl文件放入.whl
文件夹中。
Step3 : Edit your requirements.txt to add the --find-links
option at the top. 步骤3 :编辑您的requirements.txt,在顶部添加--find-links
选项。
--find-links wheelhouse
lxml==3.8.0
Step4 :Deploy your flask project to azure. 第4步 :将烧瓶项目部署为天蓝色。
For more details , please refer to the Troubleshooting - Package Installation chapter in the official document and wheel document . 有关更多详细信息,请参阅官方文档和wheel文档中的“ 故障排除-软件包安装”一章。
Hope it helps you. 希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.