I am trying to use a Post Deployment Action on Azure App Service with a Flask app. I followed this Stack overflow post to accomplish the Post Deployment Action, but this results in the container not starting with this error: Container has finished running with exit code: 0
. According to this that means that the container has run to completion due to not running continuously, so I assumed that this means that I also need to start the Flask app via gunicorn at the end of my Post Deployment Action.
I therefore added this at the end of my /home/site/deployments/tools/deploy.sh
as per this:
gunicorn –bind=0.0.0.0 –timeout 600 –workers=3 app:app
But this results in this error:
ModuleNotFoundError: No module named 'app'
My app.py is in the root of my deploment and I use app = Flask(__name__)
as per this App Service start Flask tutorial, so I am not sure where I am going wrong. When the container deploys the code is copied to something like /tmp/8dca0e6e81ee3cf
so I am not sure whether I have to magically change direction there; which would be impossible since the directory changes on every start of the app. Where am I going wrong?