0

編輯:問題似乎是我的應用程序包中的導入。所有的軟件包都安裝正確,我可以在我的wwwroot中使用kudu來查看它們。 但是,當我在腳本中導入它們時,出現500錯誤。該WIERDEST的是,這個問題只發生在我導入數據包是這樣的:Azure Python Web應用程序內部服務器錯誤

from package import something 

但不是這樣:

import package 

我也得到了同樣的錯誤,當我嘗試調用包函數,這意味着我不能訪問包中的任何東西(?)

似乎在web應用程序中生成了一個異常,但在我的本地機器中卻沒有生成異常。有什麼想法嗎?


我想在Azure Web應用程序中發佈一個Python Web應用程序,但我一直在失敗。 我用瓶作爲web框架,我安裝的,與它們的依賴沿着封裝:

  • numpy的
  • SciPy的
  • Scikit圖像

我已經配置了虛擬環境,以匹配網絡應用程序(32位/ 2.7),我安裝了使用輪子的軟件包,如本文所述:https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-bottle-app/

我正在部署應用程序通過VS和Azure SDK的發佈嚮導,一切都按預期工作。

即使應用了,我得到一個500錯誤,並在控制檯說這些東西: enter image description here

我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> 

任何幫助,爲什麼會發生?

+0

這個應用程序是否適合你在本地機器,如果是的話,那麼我們必須啓用日誌記錄並通過你的web應用程序的kudu控制檯檢查日誌 –

+0

@ BrijRajSingh-MSFT感謝您的回答。是的,這個應用程序在我的本地機器上按預期工作。我們應該檢查捻角羚怎麼辦? – achigeor

回答

1

最後,我得到了它的工作。 問題是我用來安裝車輪的點的版本。在我升級到pip 8.11.1之後,一切都按預期工作。

相關問題