Flask
Last updated
Last updated
Flask is a Python web framework built with a small core and easy-to-extend philosophy. Read more at Full Stack Python.
If you need to run Flask on another version of Python, you'll need to get a VPS.
Server | Flask Version | Python Version | Python Path | Loader | Python Modules Installed |
---|---|---|---|---|---|
If you need to run Flask on another version of Python, you'll need to get a VPS.
Server | Flask Version | Python Version | Python Path | Loader | Python Modules Installed |
---|---|---|---|---|---|
flasktest
.If you were transferred from the old cPanel, your main domain will be parked on the public_html
directory.
If you created a new account on Plesk, your directory will be httpdocs
.
.htaccess
file inside the flasktest
directory with these contents:flask.wsgi
inside the flasktest
directory with these contents:myapp.py
inside the flasktest
directory with these contents:Screenshot taken from https://krydos.heliohost.org/flasktest/
Flask changes can take up to 2 hours to appear consistently on your site because WSGI uses server side caching.
If you want site changes to take effect immediately, please refer to the options below.
Multiple Apache processes are running on the server, and each time you refresh your site you are randomly assigned to one of these processes. If that particular process has already displayed your site, it shows the cached version of your code; otherwise, it shows the new code changes. This means that during the first 2 hours after a site change, you may intermittently see old or new content, depending on which process you get assigned to. This situation will resolve when Apache is restarted, which happens every 2 hours.
A new feature currently in beta is the ability for users to restart their Flask app themselves.
To request this, please create a new post in the Customer Service forum and provide your username, server name, and the domain name(s) you want to be given WSGI Control Access for. (If you have 2 Flask apps on 2 different domains, you need to request WSGI Control Access for each domain.)
Once you have been given WSGI Control Access, you can edit your flask.wsgi
to reload your Flask app so new code changes load immediately. The edits to the file can be as simple as adding or removing a space or a blank line. As long as the file's last modified date
changes it will discard the cache and reload your Flask app.
Please let us know if you experience unexpected results with this new feature.
If you request an account reset you will need to re-request WSGI Control Access after the reset has been completed. By default, account resets will disable WSGI Control Access.
Another option to see code changes reflected immediately is to develop your Flask app on your home computer and then host the production copy on the server.
You may prefer to explore one of our paid VPS Plan options, depending on your requirements.
If you receive an error of You don't have permission to access /flasktest/flask.wsgi/ on this server
, you may need to add AddHandler cgi-script .py
on a new line in your .htaccess
file.
The above example is for Flask in a subdirectory, so users can host different projects in different subdirectories rather than dedicating the whole domain to one Flask app.
If you prefer to run Flask at the webroot instead, this is possible with some slight changes to the .htaccess
, flask.wsgi
, and myapp.py
files.
This tutorial is adapted from the How to Use Flask on Plesk post on the HelioNet forum, answered by Krydos.
Johnny
3.0.3
3.12
/usr/bin/python3.12
WSGI
Tommy
3.0.3
3.12
/usr/bin/python3.12
WSGI