• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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