Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Great, with webpy I can make it. Thx –  GProduct Aug 11 at 20:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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