javascript – Run Python File from server on click of html button-ThrowExceptions

Exception or error:

I have a python file on my server. I want to run this file whenever user clicks submit button. Both my files .py and .html are in different directories. And I also cant use any framework

How to do this?

How to solve:

One option (as suggested by furas) is to use a python framework (Django, Flask, Bottle) on the backend to create an API server. You could equally do this in node with a call to require('child_process').exec()

The other older method is to configure FastCGI on your webserver, which can automatically turn your python file into a url. Here are some stackoverflow answers for that method:

Leave a Reply

Your email address will not be published. Required fields are marked *