On my raspberry pi i have apache2 running. i have a very basic image displayed when you go to the site. What i want to be able to do is, when the image is clicked i want the following script to run.
import subprocess
subprocess.call('./milight_sources/milight 0 ON', shell=True)
Now, i'm pretty sure django isn't the answer and neither is Flask. can you suggest the best way to do this? perhaps i don't even need to use a framework at all?
I'm pulling my hair out over this and am determinted to get it working. any suggestions will be great.
Many thanks!
-
A template system like jinja? jinja.pocoo.orgcdarke– cdarke2016年02月14日 17:36:07 +00:00Commented Feb 14, 2016 at 17:36
-
It's pretty easy to do using cgi-bin. Add the python file to your cgi-bin folder, make sure .py files are enabled for cgi scripts, chmod the python file to 755, then add a javascript redirect when someone clicks on the image. You can also add a redirect at the bottom of the python file to return to the webpage you were on.Joseph James– Joseph James2016年02月14日 17:45:09 +00:00Commented Feb 14, 2016 at 17:45
-
Thank you so much, this is exactly what I am looking for. Something simple and I've just read through how the cgi-bin works and it's exactly what I need. thank you thank you thank you!!Comm4nd0– Comm4nd02016年02月15日 10:01:23 +00:00Commented Feb 15, 2016 at 10:01
1 Answer 1
Sounds like a small script that utilizes cgi should do the job
Sign up to request clarification or add additional context in comments.
Comments
default