Enabling python scripts to run in browser

rascalsailor

Registered
Sep 28, 2020
2
0
1
South Africa
cPanel Access Level
Website Owner
Forgive me if this is obvious or basic - I have a domain and have done the 'setup python app' from Cpanel to create a new application in Cpanel. I have the setup as follows in the attached pic. called python_app_en

I also added the .py extension under Apache handlers
The public_html folder contains the files/folders as in the attached pic called public_html
The cgi-bin folder contains the files/folders as in the attached pic called cgi_bin
Now if I browser to this link in my domain, the browser displays:

It works!

Python v3.5.9
(which seems to be the index.py script being run)

But how do I run my own script in the browser, say the testing.py script? I tried placing it as part of the URL as : http://www.domain.tld/testpython/testing.py
(I can go to the console and run my script there, but I want to execute from the browser)
What am I doing wrong?
Regards
Russell
 

Attachments

Last edited by a moderator:

rascalsailor

Registered
Sep 28, 2020
2
0
1
South Africa
cPanel Access Level
Website Owner
HI, I don't see that logfile - my directory structure is as in the etc.jpg pic attached
The only error file I found is error_log under: /public_ftp/public_html/error_log (and it's empty)
It is possible that my (hosted) server does not allow python files to run in the browser.
Where should I locate the .py file to run (in cgi-bin ?)
browsing to: domain.co.za
gives: Internal Server Error
Here's the location of the testing.py file gives internal server error
 

Attachments

Last edited by a moderator: