Azure Flask Deployment - WSGI Interface Azure Flask Deployment - WSGI Interface flask flask

Azure Flask Deployment - WSGI Interface


Have you considered using a web app to get Flask up and running? Here is a comprehensive guide about how to deploy Flask on a web app:https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-flask-app/

It will automatically set you up with a site and handle the web.config and fast cgi scripts.


I built a test Azure Cloud Service with Flask, tried to reproduce your issue, fortunately, I found the problem.

I copied relative packages to my test project, the found if the entrance file in root directory was named app.py, it would occur the same error with you. But I renamed the file to manage.py the project worked fine.

Per my understanding, maybe the entrance file app.py and the package named app would be in conflict for mapping.


After a bit of troubling shooting I was able to find a solution to my problem but was unfortunately unable to isolate exactly what went wrong.

Basically I went through the process of rebuilding my test project from scratch in VS2015 (Python -> Azure Cloud Service -> Flask Web Role) and was somehow this time able to get a working solution using the 7a test project with it running in the Azure Emulator followed by successfully publishing it as an Azure Web App.

I believe my problem could have resulted from one of the following issues:

  • The requirements.txt file was most likely not up to date. Note that when you run the Azure Simulator it checks the requirements.txt file and updates/installs any libraries that you don't currently have installed in your python environment automatically (without a prompt).
  • I possibly didn't have the ConfigureCloudService.ps1 or ps.cmd file in the bin folder in the Flask Worker Role Project. (It's also worthwhile reading through the Readme.mht file if you run into any problems)
  • I also changed the base of the manage.py file to:

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

Which may have helped as well.

I hope this helps out anyone else who may run into a similar issue.