在Azure上发布Flask Web App [英] Publishing Flask Web App on Azure
问题描述
- IIS收到请求;然而,在处理请求期间发生了内部错误
。此
错误的根本原因取决于哪个模块处理请求,以及发生此错误时在辅助进程中发生了什么
。
- IIS无法访问Web站点
或应用程序的web.config文件。如果NTFS权限设置为
不正确,则会发生这种情况。- IIS无法处理
网站或应用程序的配置。- 已通过身份验证的用户
不具有使用此DLL的权限。- 请求被映射到
托管处理程序,但.NET扩展性功能不是
安装。
我几乎不知道这是什么意思。这是我第一次发布这么漂亮的新手。
我的项目有以下结构。
My Views.py使用以下代码调用senna-win32.exe:
pre $ sen $ c $ sen $ s $ os $ path $($'$'$ $ $ $ $ $ $ $ senna_path,stdout = subprocess.PIPE,stdin = subprocess.PIPE)
grep_stdout = p.communicate(input = bytes(va,'utf-8'))[0]
inList = grep_stdout.decode )
inList = list(inList.splitlines())
好像没有问题/我的本地主机上的错误,但不知道是怎么回事azure。
根据我的经验,有很多原因会导致问题就像你的。
对于第一种情况, reqirements.txt
文件中所需的某些Python包不是直接安装在Azure WebApp上。在这种情况下,您需要遵循官方的疑难解答来解决它。甚至,你可以尝试按照我的解决方案为其他SO线程发布MVC应用程序使用python脚本来解决它。
但是,我认为你的问题可能是由 senna_path $ c $您的代码中的c>不是Azure WebApp上的有效路径。我试图创建一个简单的Python脚本,如下所示,以在Azure WebApp上使用Kudu控制台测试代码,它可以通过命令
python test.py>正常工作。 test.out.txt
。
从子流程导入os
导入Popen,PIPE
path = os.path.join('senna-win32.exe')
p = Popen(path,stdin = PIPE,stdout = PIPE)
grep_stdout = p.communicate输入=开心时间.encode('utf-8'))[0]
inList = grep_stdout.decode()
inList = list(inList.splitlines())
print inList
所以我的建议是尝试使用绝对路径 D:\ home\site\wwwroot\FlaskWebProject1\senna\senna-win32.exe
而不是 senna \ senna-win32.exe
为您的应用程序解决问题。
任何更新,请随时让我知道。
I have Flask web app that im trying to publish on azure. I deployed it on web app, Created new resource, downloaded user publish profile and published it from visual studio using the downloaded file. Everything runs smoothly on localhost but once published im getting error:
- IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
- IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
- IIS was not able to process configuration for the Web site or application.
- The authenticated user does not have permission to use this DLL.
- The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
I have little to no knowledge what this means. This is my very first web to publish so im pretty newbie.
My project has following structure.
My Views.py calls senna-win32.exe with the following code:
senna_path = os.path.join('senna\\senna-win32.exe')
p = subprocess.Popen(senna_path, stdout=subprocess.PIPE,stdin=subprocess.PIPE)
grep_stdout = p.communicate(input=bytes(va, 'utf-8'))[0]
inList = grep_stdout.decode()
inList = list(inList.splitlines())
It seems to have no issues/errors on my localhost but not sure whats going on azure.
Per my experience, there are many reasons which will cause the issue like yours.
For the first case, some Python packages required in the reqirements.txt
file are not directly installed on Azure WebApp. For this case, you need to follow the offical toturial for troubleshooting to solve it. Or even, you can try to follow my solution for the other SO thread Publishing MVC app that uses python script to solve it.
However, I think your issue might be caused by the senna_path
in your code is not a valid path on Azure WebApp. I tried to create a simple Python script as below to test your code using Kudu console on Azure WebApp, it works fine via command python test.py > test.out.txt
.
import os
from subprocess import Popen, PIPE
path = os.path.join('senna-win32.exe')
p = Popen(path, stdin=PIPE, stdout=PIPE)
grep_stdout = p.communicate(input="happy time".encode('utf-8'))[0]
inList = grep_stdout.decode()
inList = list(inList.splitlines())
print inList
So my suggestion is that try to use the absolute path D:\home\site\wwwroot\FlaskWebProject1\senna\senna-win32.exe
instead of senna\senna-win32.exe
for your app to solve the issue.
Any update, please feel free to let me know.
这篇关于在Azure上发布Flask Web App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!