Azure Web App: No Module Found Error

Joseph Milton 20 Reputation points
2023-01-31T12:44:12.0266667+00:00

I have seen a few questions like this but none of the answers seem to work for me. I have a flask application in github, I have set up the Azure secret. When I deploy the app it says it's a success, however, when I click browse I get the error 'application error' on the web page. From exploring the logs it seems to be because of the import gtts. I have added this to my requirements but still get the error. I've attached below the imports used in the app, the requirements and the log error, thanks

Screenshot 2023-01-31 at 12.42.49.png Screenshot 2023-01-31 at 12.38.09.png Screenshot 2023-01-31 at 12.42.35.png

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,533 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 24,546 Reputation points Microsoft Employee
    2023-01-31T18:58:13.0366667+00:00

    @Joseph Milton depending on how you deployed, it appears to me the packages from the requirements.txt didn't get installed. To ensure this is being done, make sure your app service has SCM_DO_BUILD_DURING_DEPLOYMENT set to True under your app service Application Settings blade. Normally, this is done automatically if you're deploying using Visual Studio/Code or Azure CLI az webapp up command. If you're doing GitHub Actions, make sure you yaml file is configured properly.

    I created a basic Flask app in Visual Studio and added gTTS package and didn't have any issues with the web app loading

    from gtts import gTTS
    from flask import Flask
    app = Flask(__name__)
    
    tts = gTTS(text="Hello", lang='en')
    tts.save("hello.mp3")
    
    0 comments No comments