0

I have a temperature sensor on my Raspberry Pi 2, I read the data with a python script. My question is how do I run that script on the Apache server (with a push of a button). Specifically how do I run a Python script through Apache server?

0

The answer is you use the CGI (Common Gateway Interface).

The precise details of how you would use CGI depends on the script you want to use on the Pi.

There is a pigpio CGI example for my pigpio library in these Python examples.

There is a somewhat simpler method not involving pigpio or Apache if you run your own Python server on the Raspberry Pi. There is example code called Easy as Pi Server at these Miscellanous examples. You'd need to look through the code example comments to see how it should be used.

  • Great, with webpy I can make it. Thx – GProduct Aug 11 '15 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.