Search code examples
pythonazuredeploymentbotframeworkazure-webapps

Azure Deployment Issue in Python Language using Microsoft Bot Framework


I am trying to deploy a bot to Azure built on Microsoft Bot Framework in Python. The Bot is working locally on Bot Emulator. Using Visual Studio Code for the bot development.

Deployed the Bot to Azure on a WebApp successfully using the startup command as :

python3.7 -m aiohttp.web -H 0.0.0.0 -P 8000 app:init_func

My app.py file:

def init_func(argv):
    app = web.Application(middlewares=[aiohttp_error_middleware])
    app.router.add_post("/api/messages", messages)
    return app
if __name__ == "__main__":
    app = init_func(None)

    try:
        web.run_app(app, host="0.0.0.0", port=CONFIG.PORT)
    except Exception as error:
        raise error

**The Error I am getting is **

2021-06-07T14:15:21.045987180Z aiohttp.web: error: unable to import main: No module named 'app'

I referred following answers from stackoverflow, but it doesn't work for me

  1. How to Deploy MS Botframework in Python to Azure
  2. Running an Python App as an Azure Web App

Also referred the Microsoft documentation:

  1. https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=bash&pivots=python-framework-flask
  2. https://learn.microsoft.com/en-gb/azure/app-service/configure-language-python
  3. https://learn.microsoft.com/en-gb/azure/app-service/configure-language-python#modulenotfounderror-when-app-starts
  4. https://learn.microsoft.com/en-us/azure/developer/python/tutorial-deploy-app-service-on-linux-04

I am stuck in deploying this bot to Azure for a week now. Any help/pointers/suggestions is much appreciated.

Thanks in advance.


Solution

  • Some restrictions to create app id and password in your student azure account, try to check without app id and password

    hope it will work.