Operating System & Version
lien d'aide corrompu
cPanel & WHM Version
90.0.16

radjiv

Registered
Apr 16, 2021
2
0
1
REUNION
cPanel Access Level
Website Owner
Hello, i install Python in CPanel:
the passenger_wsgi.py
Python:
import imp
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
wsgi = imp.load_source('wsgi', 'python')
application = wsgi.python
I want to create a file test with ajax:

JavaScript:
$.ajax({
type: 'POST',
url: "mysfilepython.py",
data: {param: xyz}, //passing some input here
dataType: "text",
success: function(response){
output = response;
alert(output);
}}).done(function(data){
console.log(data);
alert(data);
});
How i can proceed to get this param in python ?
Thank you.
 
Last edited by a moderator:

radjiv

Registered
Apr 16, 2021
2
0
1
REUNION
cPanel Access Level
Website Owner
hello, I am trying to establish a communication of an html form and python,
and then python send me back a response.
How does python capture the object send by a form post and where to put this python code ?

I try this code in file "mysfilepython.py"

Python:
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
def python(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    if len(sys.argv) > 1:
          output = sys.argv[1]
    else:
          output = 'no argument found'
    return output
but I have no answer
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,418
1,000
313
cPanel Access Level
Root Administrator
Thanks for the additional details. I'm not personally sure, but this might be a better question for a development-specific forum as we primarily deal with the cPanel software here. It's possible another user will share their experience though!