• Register
0 votes
781 views

Problem :

I am trying to deploy my Python Flask application in my Azure web app. I had created web app(Flask) and published the code. After publishing it, I am facing below error from the site.

The page cannot be displayed because an internal server error has occurred.

When I checked the Log, I could see the above error.

But this was the case only in my subscription(my free subscription with MSDN). But it was working fine in the Organisation subscription.

6 5 3
7,540 points

1 Answer

0 votes

Solution :

I have gone through your question and I understood it.

I had faced the similar issue in the past and so know the solution on it.

The <fastCGI> settings must be done in your applicationHost.config file (in your system.webServer section) of IIS. Just putting it into your web.config does not work (I can confirm it by testing it on a local IIS). An example of the configuration may look like as below :

<fastCgi>
  <application
    fullPath="C:\home\Python27\python.exe"
    arguments="C:\home\Python27\wfastcgi.py"
    maxInstances="16"
    idleTimeout="21600"
    instanceMaxRequests="10000000"
    signalBeforeTerminateSeconds="60"
    xdt:Transform="InsertIfMissing"
    xdt:Locator="Match(fullPath)">
    <environmentVariables>
      <environmentVariable name="PYTHONHOME" value="C:\home\Python27" />
    </environmentVariables>
  </application>
</fastCgi>

You must adjust your configuration according to above configuration.

This should help you in solving it for a local IIS where you can edit the applicationHost.config.

Further Readings :

You can find more hints below: 

https://github.com/Azure/azure-python-siteextensions/issues/2.

9 7 4
38,600 points

Related questions

0 votes
1 answer 1.2K views
1.2K views
Problem : I am trying to convert my working Python 2.7 code into Python 3 code but I am facing following error post data should be bytes, an iterable of bytes, or a file object. it cannot be of type str.
asked Nov 16, 2019 peterlaw 6.9k points
1 vote
1 answer 222 views
222 views
Problem : I am getting bellow flask app error error: could not locate flask application. you did not provide the flask_app environment variable.
asked Nov 8, 2019 peterlaw 6.9k points
1 vote
2 answers 2.9K views
2.9K views
Problem : Getting bellow python and django error 'virtualenv' is not recognized as an internal or external command, operable program or batch file.
asked Nov 8, 2019 peterlaw 6.9k points
0 votes
1 answer 94 views
94 views
Problem : I am unable to understand what am I missing here: Sort my_short_names in reverse alphabetic order. The sample output from the given program as below : ['Tody', 'Samy', 'Joey', 'Jany', 'Anny'] Below is my code for your reference : my_short_names = ['Jany', 'Samy', 'Anny', 'Joey', 'Tody'] my_short_names.sort() print(my_short_names)
asked Jan 8 alecxe 7.5k points
0 votes
1 answer 341 views
341 views
Problem: I have recently started learning Python so I have only fundamental knowledge in Python. Please find below my Transaction class for your reference: class Transaction(object):     def __init__(self, company, num, price, date, is_buy):         self.company = company         ... Python and because of lockdown I am unable to find any help to fix this issue. So I am posting my question here.
asked Aug 10 Raphael Pacheco 4.9k points