Vishakha Mishra
Vishakha Mishra

Reputation: 1

Run Python File from server on click of html button

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?

Upvotes: 0

Views: 303

Answers (1)

James McGuigan
James McGuigan

Reputation: 8086

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:

Upvotes: 1

Related Questions