Running python file in a server ran by JS


#1

Hello.
I’d like to run a python file that contains asyncio, but I’m running the server with JS. What should I do?
Should I use the following:

$.ajax({type: "POST", url: "/my_python_file.py", async: false, data: { param: input })

in the JS server script or is there a better alternative?

Thanks.


#2

Example:

$.ajax({
  type: "POST",
  url: "~/pythoncode.py",
  data: { param: text}
}).done(function( o ) {
   // do something
});