I've made a simple app with Django in Visual Studio 2017, utilizing the default template in Visual Studio (file - new - project - python - django web application). I've installed django PTVS through the azure portal and added a custom python extension. The app runs properly locally, but after i deploy it to Azure via Visual Studio, i can only access the page that shows:
'Your App Service app has been created.'
I've read several posts (Deploy a simple VS2017 Django app to Azure - server error) and followed the following tutorials: https://learn.microsoft.com/en-us/visualstudio/python/managing-python-on-azure-app-service
My web.config looks as follows:
<?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:
I managed to get it working, the problem was that it still kept using the env with python 3.4 and there seemed to be a package dependency that required a newer version of python I therefore changed the app settings as follows.
<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>