You can find the step-by-step deployment guide here.
Hostman uses the following environment when building a Flask application:
Hostman will execute the following commands during the build:
apt install -y python3 python3-pip gunicorn python3-psycopg2 libpq-dev python-dev default-mysql-client python3-dev default-libmysqlclient-dev python3-mysqldb --fix-missing
pip3 install psycopg2 flask
ln /usr/bin/python3 /usr/bin/python -sf
ln /usr/bin/pip3 /usr/bin/pip -sf
If the project has a requirements.txt
file, we will also run:
pip3 install --upgrade -r requirements.txt
For the app to deploy correctly, you may need to modify the start command to suit your project, specifying port binding, for example:
gunicorn main:app --timeout 60 --bind 0.0.0.0:80
Make sure the application initialization file (your app entry point) is named main.py
.
If there are problems with deployment, first check the deployment log. You will be able to determine at what point something went wrong.
Most errors are usually related to:
main.py
file or the app
variablerequirements.txt
Make sure that the gunicorn main:app
command runs successfully in your local environment.