Azure App Service - url for website not working

1.6k Views Asked by At

I have been trying to publish my first ever Django web application and going through many hurdles over the last two days, I am still unable to access it via the url - it's not live.

I have published it from VS2017, set up continuous deployment from VSTS, installed Python 3.6 extension, updated my web.config file, installed required packages in Kudu, the app is redirected to a cloud-based data base.

I followed the various documentation sites to the letter e.g.: Deploy your app to Azure App Service and Managing Python on Azure App Service but I still can't just browse to my url - I am getting a welcome page saying "Your App Service app has been created" and some tutorials.

What am I missing? What is the final stage that I need to do to make it go live?

Responding to the comment below, I have updated my web.config file in KUDU with the following code:

    <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
    <add key="WSGI_HANDLER" value="app.wsgi_app"/>
    <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
  </appSettings>
  <system.webServer>
    <handlers>
      <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\Python361x64\python.exe|D:\home\Python361x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
    </handlers>
  </system.webServer>
</configuration>

When trying to run my url I am getting an internal server error, and when I go to Python log file I am getting the following message:

D:\home\Python361x64\python.exe: can't open file 'D:\home\site\wwwroot\runserver.py': [Errno 2] No such file or directory
1

There are 1 best solutions below

0
On

It seems that you had solved partial issues in your another thread How to deploy Django app on Azure?, which I have solved it and posted my answer.

Please refer to it and the completed configuration as below:

<configuration>
  <appSettings>
    <add key="WSGI_HANDLER" value="DjangoWebProject1.wsgi.application"/>
    <add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
    <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
  </appSettings>
  <system.webServer>
    <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>