Reputation: 41
I have a flask app which I'm able to run locally no problem, the issue is when I try to run it in Azure, it seems the app.py can't be found since I'm deploying with GitHub. My file tree looks something like below, and Azure starts in the /Chatbot folder. I need to get into /Chatbot_Application/Chatbot to access app.py
Chatbot
├─── .vs
├───Chatbot_Application
│ └───Chatbot
│ ├───chatbot_backend
| ├───app.py
| ├─gunicorn.conf.py
If I run the Azure app like this I get no code output, IF I adjust the start up configuration to this
gunicorn --bind=0.0.0.0 --chdir /Chatbot_Application.Chatbot app:app
I get an error "can't chdir to 'Chatbot_Application.Chatbot'" no matter what format I put. I'm thinking of going the wsgi.py route but I don't think I'll get any luck because it won't be able to import the app.py modules.
Upvotes: 2
Views: 605
Reputation: 41
So, the solution was using this format for the startup command.
gunicorn --bind=0.0.0.0 Chatbot_Application.Chatbot.app:app
This will help Azure recognize the app.py, keep in mind the module within my app.py is called app so that's why it's app:app. You'll have to solve the issue 'cannot find module' 😣
Upvotes: 2