I\'m currently working through the book Flask Web Development, Developing Web Applications with Python and am currently having some issues determining where I should place t
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:
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.