1

Unlike Azure Flask Deployment - WSGI Interface problem, deploying Flask app to Azure Web Role throws a following problem.

AttributeError: 'module' object has no attribute 'wsgi_app'

What is this error?

Community
  • 1
  • 1
Youngjae
  • 24,352
  • 18
  • 113
  • 198

1 Answers1

5

I got it finally.

The startup .py file has to define wsgi_app after the Flask app definition.

app = Flask(__name__)

# define for IIS module registration.
wsgi_app = app.wsgi_app

if __name__ == '__main__':
    app.run()

And also, {StartupModule}.wsgi_app is defined in Project properties > Web > WSGI Handler.

To shorten trial-and-error time, it would be good to start with newly created Azure WebRole Python project template.

Whooa. spent a whole day.

Youngjae
  • 24,352
  • 18
  • 113
  • 198