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
Also referred the Microsoft documentation:
- https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=bash&pivots=python-framework-flask
- https://learn.microsoft.com/en-gb/azure/app-service/configure-language-python
- https://learn.microsoft.com/en-gb/azure/app-service/configure-language-python#modulenotfounderror-when-app-starts
- 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.
python3.7as a command rather thanpythonorpyorpy -3.7? I've never seen that before. You say you're using VS Code for deployment but the documentation you linked to doesn't mention VS Code. How are you using that documentation? One of the documents you linked to clearly explains that the error you're seeing is most likely caused by erroneously deploying a virtual environment. Have you verified that you're not deploying a virtual environment by checking the code in your app service? Please be more descriptive about what's happening than saying "it's not working"