-
11Step 11
Now it's time to import code from git. In the Terminal window, run:
git clone https://github.com/vpetrache/Raspberry-Pi-Web-Application-Temperature-Reading.git
This will create a folder called Raspberry-Pi-Web-Application-Temperature-Reading with monitor.py and webgui.py in it. -
12Step 12
Go to the directory:
cd Raspberry-Pi-Web-Application-Temperature-Reading cp monitor.py /usr/lib/cgi-bin/ cp webgui.py /usr/lib/cgi-bin/
Change the file ownership:sudo chmod +x /usr/lib/cgi-bin/monitor.py sudo chmod +x /usr/lib/cgi-bin/webgui.py sudo chown www-data:www-data /usr/lib/cgi-bin/monitor.py
-
13Step 13
To add the python script to run as a job:
sudo crontab -u www-data -e
Add the follwing line at the end of the www-data file:*/15 * * * * /usr/lib/cgi-bin/monitor.py
-
14Step 14
Next step, enable the Apache web server to run the script:
sudo leafpad /etc/apache2/sites-enabled/000-default &
Navigate to line:
<Directory "/usr/lib/cgi-bin"> ... </Directory>
Add the following line:
AddHandler cgi-script .py
And restart the Apache server:sudo service apache2 reload
-
15Step 15
Restart the Raspberry Pi:
sudo reboot
Go to any browser and connect to http://YourPiIpAddress/cgi-bin/webgui.py and you should see something like this (with a few data): -
16Step 16
Wrap up. Now, when the season comes I have a functional project.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.