I have a .py file which php file works as follows:
$link = exec(dirname(__FILE__) . /xxx.py ' .excapeshellarg($url) . '2>&1', $output, $exit_code);
I want to run xxx.pydjango in my view and assign the output to a variable. The xxx.py file has a def main (url) function and if __name__ == '__main__':at the bottom. Is there a way to edit the file xxx.pyand call the main def function from my view?
Currently, it does not start, as it works on the command line when called directly from the view.
Thanks for your reply.
source
share