Visual Studioのデフォルトテンプレート(file-new-project-python-django Webアプリケーション)を使用して、DjangoでVisual Studio 2017で簡単なアプリケーションを作成しました。私はAzureのポータルからdjango PTVSをインストールし、カスタムPython拡張を追加しました。アプリはローカルに正しく動作しますが、私は、Visual Studio経由Azureのためにそれを展開した後、私はのみ表示するページにアクセスすることができます。AzureにDjangoアプリを配備するVS2017 - カスタムPython
'Your App Service app has been created.'
私はいくつかの記事(Deploy a simple VS2017 Django app to Azure - server error)を読み、次のチュートリアルに従ってきました:次のようにhttps://docs.microsoft.com/en-us/visualstudio/python/managing-python-on-azure-app-service
私のweb.configファイルに見えます:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="Python27_via_FastCGI" />
<remove name="Python34_via_FastCGI" />
<add name="PythonHandler" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\python361x64\python.exe|D:\home\python361x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
</handlers>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<appSettings>
<add key="PYTHONPATH" value="%SystemDrive%\home\site\wwwroot" />
<add key="WSGI_HANDLER" value="DjangoWebProject2.wsgi.application()"/>
<add key="DJANGO_SETTINGS_MODULE" value="app.settings" />
</appSettings>
</configuration>
UPDATE:
私はそれを動作させることができました。問題は、まだpython 3.4でenvを使い続けていたことでした。パッケージの依存性が必要なpythonの新しいバージョンが必要なので、次のようにappの設定を変更しました。
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="myApp.wsgi.application"/>
<add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
<add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
<add key="PYTHONPATH" value="D:\home\site\wwwroot" />
<add key="DJANGO_SETTINGS_MODULE" value="myApp.settings" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<add name="PythonHandler" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\python362x86\python.exe|D:\home\python362x86\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>
こんにちは、更新はありますか? –
@JayGong申し訳ありませんが、私はすでに結果を投稿したと思いました。だから私はそれを動作させることができた、問題は、それがpython 3.4でenvを使用し続けているように見えた。したがって私は、新しいpythonバージョンを使用するようにアプリの設定を変更した。 – Galdar
お返事ありがとうございました。私の答えはこの問題を要約したものです。あなたは他の人のリファレンスをフォーラムに記入することができます。 –