Reputation: 3
I have a python file named myfile uploaded on github and heroku app linked to that github repo.
Now when I run heroku run myfile.py
on CLI of heroku it is working fine with the output as a string.
Also ,
So what I want is when user clicks a button in the page,
heroku run myfile.py
command should be run on heroku .Anybody knows how to do this (in the script section of html ) ?
Upvotes: 0
Views: 100
Reputation: 32627
The easiest way would be to change how myfile.py
works, and to have it expose an API.
Using a tool such as gunicorn, you could expose an HTTP endpoint to your app. Your Javascript would then be able to make a call to that endpoint, and retrieve any response it sends.
See Getting started with Python on Heroku.
Upvotes: 1