• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Input Guide for Python Flask App deployement

andostini

New Pleskian
Hey there,

does anybody have a nice guide on deploying python flask applications on plesk. I have already tried many different ways but most of them stall at some point, mostly because of plesk related issues.

Or maybe does someone have some experience and can recommend a certain path to go. Like using passenger, or gunicorn? No expecting a full guide but some technologies that you have made good experience with?


Would be greatful on sime help here.

Fabian
 
Hey there,

does anybody have a nice guide on deploying python flask applications on plesk. I have already tried many different ways but most of them stall at some point, mostly because of plesk related issues.

Or maybe does someone have some experience and can recommend a certain path to go. Like using passenger, or gunicorn? No expecting a full guide but some technologies that you have made good experience with?


Would be greatful on sime help here.

Fabian

I managed to run a Flask Hello World on VPS Server with Linux and Apache by following instructions from Install and configure a full software stack for a Flask app: Apache, Gunicorn, MongoDB, Redis - Vioan's Blog

My starting point was a visible web domain that could access an index.html page.

# I removed the index.html
export LC_ALL=C
sudo python3 -m venv venv
. venv/bin/activate
# I created a file with hello world flask app https://flask.palletsprojects.com/en/1.1.x/quickstart/#a-minimal-application
export LC_ALL=C
pip install Flask
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export FLASK_APP=hello.py
flask run
# for some debug messages run flask run --host=0.0.0.0
# from Install and configure a full software stack for a Flask app: Apache, Gunicorn, MongoDB, Redis - Vioan's Blog I followed did the following part:

--------------------------------
# configure Apache to serve our Flask app:
a2enmod proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
service apache2 restart

#create our Apache config file specific to our domain:
cd /var/www/vhosts/system/<your domain>/conf

# in file /var/www/vhosts/system/<your domain>/conf/vhost.conf enter the content below.
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
<Location "/">
ProxyPass "http://127.0.0.1:5000/"
ProxyPassReverse "http://127.0.0.1:5000/"
</Location>

# Restart Apache
service apache2 restart

#Access your website using HTTP:// not HTTPS:// as a first step
--------------------------------
 
Last edited:
Back
Top