Using Python in web hosting

Skip to main content
Du bist hier:
Drucken

Using Python in web hosting

Python is available in UNIX hosting (Linux), including UNIX reseller hosting. You will not find it among the scripting languages in the hosting settings. It is a separate feature called «Python» for your domain in Plesk. The interface of this feature is currently only available in English.

Step 1: Log in to Plesk

Log in to the hosting administration (Plesk). You can find the instructions here: Log in to Plesk

Step 2: Open «Python» for the domain

Open «Websites & Domains», click the domain you want and then «Python».

Step 3: Enable Python

Click «Enable Python» and choose the folder of your application.

Step 4: Create a virtual environment

Click «Create Virtual Environment». This creates a virtual environment for your application.

Step 5: Install packages

Click «Install Dependencies». This installs the packages from your requirements.txt file (or uv.lock).

Step 6: Restart the application

After changing the code, restart the application with «Restart App».

Good to know

  • Web application, not single scripts: Single .py files are not run directly in the browser like PHP scripts. In web hosting, Python runs as a web application, for example with Flask or Django, via the startup file passenger_wsgi.py.
  • No background processes: The application starts with the first request and is stopped again after 5 minutes without requests. Permanently running background processes are not intended in web hosting. A root server is suitable for that.
  • Prebuilt packages only: Packages that would have to be compiled during installation cannot be installed in web hosting. The installation then stops with an error message. Packages that are offered as a prebuilt package (wheel) can be installed.
  • Updates: Python and the installed packages are stored in your webspace. You update Python and the packages yourself.

The best way to find out whether your application runs this way is to try it directly with your project.

Related Post