【发布时间】:2016-03-26 13:44:36
【问题描述】:
编辑:问题似乎是在我的应用程序中导入包。所有软件包都已正确安装,我可以在带有 kudu 的 wwwroot 中看到它们。 但是,当我在脚本中导入它们时,我得到了 500 错误。最奇怪的是,只有当我以这种方式导入包时才会出现问题:
from package import something
但不是这样:
import package
当我尝试调用包函数时,我也遇到了同样的错误,这意味着我无法从包中访问任何内容(?)
似乎在 Web 应用程序中生成了异常,但在我的本地计算机中没有。有什么想法吗?
我正在尝试在 Azure Web 应用程序中发布 Python Web 应用程序,但一直失败。 我使用 bottle 作为 web 框架,我安装的包以及它们的依赖项是:
- 麻木
- Scipy
- Scikit 图像
我已配置虚拟环境以匹配 Web 应用程序(32 位/2.7),并使用本文中提到的轮子安装包:https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-bottle-app/
我正在通过 VS 和 Azure SDK 的发布向导部署应用程序,一切正常。
当应用程序启动时,我收到 500 错误,控制台会显示以下内容:
我的 web.cofing 是这样的:
<?xml version="1.0"?>
<!-- Generated web.config for Microsoft Azure. Remove this comment to prevent
modifications being overwritten when publishing the project.
-->
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31b....." name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="WSGI_ALT_VIRTUALENV_HANDLER" value="app.wsgi_app()" />
<add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\activate_this.py" />
<add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_virtualenv_handler()" />
<add key="PYTHONPATH" value="D:\home\site\wwwroot" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<add name="Python FastCGI" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\Python27\python.exe|D:\Python27\Scripts\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<rewrite>
<rules>
<rule name="Static Files" stopProcessing="true">
<conditions>
<add input="true" pattern="false" />
</conditions>
</rule>
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
任何帮助为什么会发生这种情况?
【问题讨论】:
-
这个应用程序在本地机器上是否适合您,如果是,那么我们必须启用日志记录并通过您的 webapp 的 kudu 控制台检查日志
-
@BrijRajSingh-MSFT 感谢您的回答。是的,这个应用程序在我的本地机器上按预期工作。我们应该用 kudu 检查什么?
标签: python azure azure-web-app-service internal-server-error scikit-image