• 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

Question How to run Python script on Apache web hosting server using Plesk Onyx

Centurion

New Pleskian
Hello,

I have written a web scraping Python script importing bs4, requests, os and other libraries. This script is scraping several websites, processing the soups and creating new HTML files in another folder with the outputs of the script as the content. The main HTML of my webhosting is then loading the content of these newly created HTML files into a <div>.
It works perfectly running in the local IDE.

My (linux) webhosting with Plesk Onyx 17.8.11 is supporting Python 3. The standard "Hello World!" python script in the cgi-bin folder is working and displayed correctly in the browser - meaning Python is functioning.

But as soon as I am trying to put the first lines of my Python script, importing the libraries, the result is immediately displaying an "500 Internal Server Error" page. The permissions of that "Python-CGI"-page are set for both owner and groups as "rwx" (in the Plesk GUI). How to make sure and check the permissions of that script? (e.g. 755)

I assume that my Python script is not working in a "pure CGI"-python page?
Nothing has to be "printed out" or displayed in the browser - the script is only creating/writing HTML files.
Am I forced to use a framework like Flask?
If so, how to install Flask in Plesk and implement my Python script?

I searched both in this forum and Google for similiar cases but could not find helpful stuff.
 
Back
Top