This is a transpiled version of wiringpi-php-bme280 from php to python.
The temperature, humidity, barometric pressure, and heat index obtained from the BME280 sensor are displayed on the Web screen.
It also has a function to display temperature, humidity and barometric pressure on the LCD 1602A.

- Python 3 - The script interpreter
- WiringPi-Python - Control Hardware features of Rasbberry Pi
- Apache 2 - The Apache HTTP Server
- mod_wsgi - Apache module which can host any Python web application
- Flask - A lightweight web application framework
- pycurl - A Python interface to libcurl
日本語が読める方は、 リンク:BME280で取得した温湿度気圧をWeb画面に表示する(python,wiringpi,apache) - ITC Engineering Blog を参考にインストールしてください。(Japanese text only)
apt install apache2
apt install -y libapache2-mod-wsgi-py3
pip3 install wiringpi
pip3 install Flask
apt install libcurl4-openssl-dev libssl-dev
pip3 install pycurl
cd opt
cp -p bme280.py bme280_inc.py lcd1602_inc.py /opt/
cd /opt
chmod 755 bme280.py
./bme280.py
To stop
./bme280.py stop
To run automatically at startup
vi /etc/rc.local
Add /opt/bme280.py before exit 0.
/opt/bme280.py
exit 0
cp html/bme280.html /var/www/html/
cp -r js /var/www/html/
mkdir /var/www/flask
cp py/app.wsgi /var/www/flask/
cp py/app.py /var/www/flask/
cp py/getlogdata.py /var/www/flask/
chown -R www-data:www-data /var/www/html /var/www/flask /var/log/bme280log
vi /etc/apache2/sites-available/flask_wsgi.conf
<VirtualHost *:80>
    ServerName xxx.example.com
    ServerAdmin xxx@example.com
    DocumentRoot /var/www/html
    WSGIDaemonProcess app user=www-data group=www-data threads=5
    WSGIScriptAlias /flask /var/www/flask/app.wsgi
    WSGIChunkedRequest On
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/flask/>
        WSGIProcessGroup app
        WSGIScriptReloading On
        Require all granted
        Options FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>
a2ensite flask_wsgi
a2dissite 000-default
systemctl restart apache2
Access
https://localhost/bme280.html
Install on a different server than the single node.
cp html_relay/bme280s.html html_relay/rooms.json /var/www/html/
cp -r js /var/www/html/
mkdir /var/www/flask
cp py_relay/app_relay.wsgi /var/www/flask/
cp py_relay/app_relay.py /var/www/flask/
cp py_relay/proxyproc.py /var/www/flask/
chown -R www-data:www-data /var/www/html /var/www/flask
Register the node(s)
vi /var/www/html/rooms.json
[
	{	"url": "http://192.168.2.38/", "name": "居間"		},
	{	"url": "http://192.168.2.32/", "name": "洋室1"	},
	{	"//url": "http://192.168.2.33/", "name": "洋室2"	},
	{	"//url": "http://192.168.2.34/", "name": "洋室3"	},
	{}
]
vi /etc/apache2/sites-available/flask_wsgi.conf
<VirtualHost *:80>
    ServerName xxx.example.com
    ServerAdmin xxx@example.com
    DocumentRoot /var/www/html
    WSGIDaemonProcess app_relay user=www-data group=www-data threads=5
    WSGIScriptAlias /flask /var/www/flask/app_relay.wsgi
    WSGIChunkedRequest On
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/flask/>
        WSGIProcessGroup app_relay
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptReloading On
        Require all granted
        Options FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>
a2ensite flask_wsgi
a2dissite 000-default
systemctl restart apache2
Access
https://localhost/bme280s.html
MIT