html - Start a script to Raspberry Pi without refresh the page -
i have streaming server raspberry pi. want able control servos (pan , tilt) website. therefore want start python script, starts when botton pressed @ website, without refreshing page. there way that? i'm using flask.
you want setup endpoint in flask app like:
from flask import flask app = flask(__name__) @app.route("/") def indexpage(): # serve index web page here return app.send_static_file('index.html') @app.route("/runscript") def runscript(): # whatever want here run_my_script() app.run() then in webpage have form sends request app @ runscript endpoint.
<form action="/runscript" method="get"> <input type="submit" value="submit"> </form>
Comments
Post a Comment