gproduct
Posts: 59
Joined: Tue Aug 11, 2015 1:27 pm

Raspberry Pi 2 Apache Python Script Control

Tue Aug 11, 2015 1:36 pm

I'm having some issues with my Apache Server on my raspberry pi 2.

First I bought a temperature sensor, which is working with a python script and displaying and writing the temperature into a txt file. :lol:
What I want to do is when I click a button on my apache server, the script runs and it displays the temperature.
Second I want to do is when I click a button the server executes the pythons script that sends the temperature data to me by email.
Thx!

User avatar
lmarmisa
Posts: 1265
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Raspberry Pi 2 Apache Python Script Control

Tue Aug 11, 2015 10:43 pm

Consider to use PHP:
http://www.tutorialspoint.com/php/

If you wish to display the contents of a file, call the function readfile():
http://www.w3schools.com/php/func_files ... adfile.asp

If you wish to run an external python script that sends temps to your email address, call the function system():
http://php.net/manual/en/function.system.php

gkreidl
Posts: 6326
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Raspberry Pi 2 Apache Python Script Control

Wed Aug 12, 2015 5:19 am

You can write CGIs in Python.
Or you can use mod_python:
https://www.howtoforge.com/embedding-py ... ebian-etch
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Return to “Beginners”