-2

I have made a webpage using bootstrap which is hosted on a raspberry pi. What I would like to do is to, when a certain button is clicked, is to run a python script. This is all being hosted/run/accessed through a FLASK hosting service.

Thank you for your time.

1
  • 2
    Post so far what have you tried?Are there any errors? Commented May 29, 2016 at 7:46

1 Answer 1

0

Run python method in HTML web page

I also encountered same issue, and I solved it really easily using this way. (I answered on my own question in that link)

Just redirect button to go any link let's say button , and then in flask python file, make a method something like

@app.route('/a')
def b(name=None):
    import (python script that you want to import, it should be on same folder to do it easy)
    return render_template('xxx.html',name=name)
Sign up to request clarification or add additional context in comments.

3 Comments

Will have a try tonight, thank you for your suggestion! :)
sure, how did it go?
Sorry for the late message, I have not been able to access the PI. Will be working on in it in the coming days. Will keep you updated. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.