Skip to content
Advertisement

Azure + gunicorn + flask + Azure Web App Linux: ModuleNotFoundError: No module named ‘flaskr’

the use case

I have followed the flask tutorial on those pages: https://flask.palletsprojects.com/en/1.1.x/tutorial/

The project directory is the following :

JavaScript

run the web app

The web app works by running the script ‘run_app_prod.sh’.

the code works on my local machine (ubuntu 20.04) but not on azure web app for linux

run_app_prod.sh

JavaScript

the flaskr/init.py files

JavaScript

the error message

JavaScript

Advertisement

Answer

I had a similar error without Azure. Analyzing this issue, I suspected it was an importing issue related to Gunicorn. My solution was to append the missing directory path to the beginning of my entry application script (flaskr/init.py in your case):

JavaScript

I don’t know if it’s a good practice, but it worked for me. Hope it helps for you too.

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