2016-11-10 14 views
3

Azure CloudにPythonアプリケーションを配備しようとしています。 Cookiecutter templateのWebAppをpython3.5.2x64で作成しました。テンプレートからweb.configをあらかじめ設定して使用すると、私は500エラーに直面しています:
<handler> scriptProcessor could not be found in <fastCGI> application configurationです。それは(AttributeError: 'module' object has no attribute 'get_virtualenv_handler'を発生させ、サポートされていないMicrosoft.Diagnosticsを使用しています)かなり時代遅れだから、助けにはならないアズールからDjangoのアプリを使用してMicrosoft Azure上のPython FastCGIエラー

def wsgi_app(environ, start_response): 
    status = '200 OK' 
    response_headers = [('Content-type', 'text/plain')] 
    start_response(status, response_headers) 
    response_body = 'Hello World' 
    yield response_body.encode() 
if __name__ == '__main__': 
    from wsgiref.simple_server import make_server 
    httpd = make_server('localhost', 5555, wsgi_app) 
    httpd.serve_forever() 

マイweb.configファイル:

<configuration> 
<system.web> 
    <customErrors mode="Off"/> 
</system.web> 
<appSettings> 
    <add key="PYTHONPATH" value="D:\home\site\wwwroot"/> 
    <add key="WSGI_HANDLER" value="webapp.wsgi_app"/> 
    <add key="WSGI_LOG" value="D:\home\LogFiles\python.log"/> 
</appSettings> 
<system.webServer> 
    <httpErrors errorMode="Detailed" /> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <handlers> 
    <add name="Python FastCGI" 
     path="*" 
     verb="*" 
     modules="FastCgiModule"   
     scriptProcessor="D:\home\Python35\python.exe|D:\home\Python35\wfastcgi.py" 
     resourceType="Unspecified" 
     requireAccess="Script" /> 
    </handlers> 
</system.webServer> 
</configuration> 

マイwebapp.py

私が間違っていることは何ですか?ありがとうございました。

更新。 Python Extension(Azure Portal btwからインストールされています)がIISに見えないか、まったく見えないように見えるので、Pythonのインストール済みのPython(2または3は問題ありません) 。それにもかかわらず、ネイティブのPythonを使用しても、即座には動作しませんが、最初にTypeError: source code string cannot contain null bytes(Python 3.4)またはAttributeError: 'module' object has no attribute 'wsgi_app'(Python 2.7)を投げます。そして約15分後にが魔法のようにが動作を開始します。私がやっていたことは、変化していた。Hello World!文字列。

+0

これについてのドキュメントを確認しましたか? https://azure.microsoft.com/en-gb/documentation/articles/web-sites-python-configure/ –

+0

しかし、これをアプリのように展開するか、空白の仮想マシン内に展開しようとしていますか? – Hackerman

+0

@Hackermanはアプリのように、私はWeb Appを選択し、次にGitまたはVS Code Online経由でこれらの2つのファイルを追加して再起動します。 – pro100filipp

答えて

0

解決策はかなり論理的でしたが、(私が思うように)明らかではありませんでした。私はAzureポータルのWeb App設定(Web App - > Application設定 - > Handler Mappings)にハンドラを追加しました。すべてが魅力的でした!

関連する問題