Skip to content
Advertisement

Flask Azure web app deployed successfully but showing default page

I deployed a python flask app with azure web service using local git. The status in the deployment center shows “success” but when i go to the web page, it is still the default page that tells me I’m running python 3.6.6.

When i navigate to the kudu git clone uri it says ” no route registered for ‘/testapp1.git’

The /wwwroot folder in kudu also has the following files.

env
static (css folder)
__pycache__
app.py
hostingstart-python.html
hostingstart-python.py
index.html
requirements.txt
web.config

A potential problem could be because the web.config file is still refering to the hostingstart-python.application.

<configuration>
   <appSettings>
      <add key ="pythonpath" value="%systemDrive%homesitewwwroot" />
      <add key ="WSGI_HANDLER" value="hostingstart-python.application" />
   </appSettings>
</configuration>

I tried to follow the instructions on https://learn.microsoft.com/en-us/azure/app-service/containers/how-to-configure-python but this is for linux so i’m not sure what to do as i’m running Windows 10.

Advertisement

Answer

Please refer to my work steps and see if the error still shows up.:

As you found in the Managing Python on Azure App Service , Azure App Service provide you with a site extension. You could install packages on KUDU console.

Step 1 : Create azure web app and add Extensions(here is Python 3.6.4 x64)

enter image description here

Step 2 : Publish your flask project and add the web.config.

web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="WSGI_HANDLER" value="<Your Project Name>.app"/>
    <add key="PYTHONPATH" value="D:homesitewwwroot"/>
    <add key="WSGI_LOG" value="D:homeLogFileswfastcgi.log"/>
  </appSettings>
  <system.webServer>
    <handlers>
      <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:homePython364x64python.exe|D:homePython364x64wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
    </handlers>
  </system.webServer>
</configuration>

Step 3: Switch to the Kudu CMD and commands cd Python361x64 and touch get-pip.py and copy the content of the url https://bootstrap.pypa.io/get-pip.py into the get-pip.py via Edit button, then run python get-pip.py to install the pip tool.

enter image description here

Step 4 : Install any packages you need via e.g: python -m pip install Flask

enter image description here

BTW,you could remove the default homepage.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement