Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Webapps for recording and displaying weather data

Project description

Weather Data Web application
============================

For the moment, only cron.py works.
The rest of this README file is not relevant.
Please look into cron.py for explanations.
Wait next releases to have full description.

In one word :

Install this software (For fedora)
$ sudo dnf install python3-pip
$ sudo dnf install mariadb-devel
$ sudo dnf install gcc
$ sudo dnf install redhat-rpm-config
$ pip install wdwapp

Download development.ini file from : http://static.frkb.fr/wdwapp
Exemple. Do : wget http://static.frkb.fr/wdwapp/development.ini

Adapt this file for your need.

Create a database (empty) for this app.
In phpMyAdmin for exemple you can do :
CREATE USER 'wdwapp'@'localhost' IDENTIFIED BY 'my secret password';
GRANT USAGE ON *.* TO 'wdwapp'@'localhost' REQUIRE NONE WITH
MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0;CREATE DATABASE IF NOT EXISTS `wdwapp`;GRANT ALL
PRIVILEGES ON `wdwapp`.* TO 'wdwapp'@'localhost';

Create tables :
$ wdwapp_initialize_db development.ini

Put in a cron job this command :
$ wdwapp_cron /path/to/development.ini

Because by default data is saved every 15 minutes, it is a good idea to call
the cron job 3 minutes after. This mean every hour at 3, 18, 33 and 48 minute.
To do tis with con insert this line in the crontab :
3,18,33,48 * * * * wdwapp_cron /path/to/development.ini

Start web server :
$ gunicorn --paste development.ini



DO NOT USE the rest of this file =============================================

Getting Started
---------------

- Change directory into your newly created project::

cd meteoweb

- Create a Python virtual environment::

python3 -m venv env

- Upgrade packaging tools::

env/bin/pip install --upgrade pip setuptools

- Install the project in editable mode with its testing requirements::

env/bin/pip install -e ".[testing]"

- Run your project's tests::

env/bin/pytest

- Download ini files::

wget http://static.frkb.fr/wdwapp/development.ini
wget http://static.frkb.fr/wdwapp/production.ini

- Adapt ``domaines`` entry in ``[app:main]`` section from ini file
see on https://api.ovh.com/ how to obtain keys.
Or go directly to https://api.ovh.com/createToken/index.cgi

- Run your project::

env/bin/pserve development.ini
or
env/bin/pserve production.ini

- Acces your project:

http://localhost:6543

- Retrieve weather data using a cron job.

Get the URL http://localhost:6543/cron every 15 minutes.
The best way is to add the following line in a crontab :

*/15 * * * * wget -q -O /dev/null http://dev.local:6543/cron

Replace dev.local:6543 with your domain if you have one.
The interval used to call this service determine the data interval.




Change log
----------

- **0.0.8** 2017/12/28

- Data base update. Suppress unique index on sensor id in location.
Please run V007to008.sql available on http://static.frkb.fr/wdwapp

Corrections :
- When new sensor is detected save first data received.
- Internal Server Error after lost MySql connection due to interactive
timeout.
Resolved by adding pool_pre_ping=True to create_engine.

- **0.0.7** 2017/12/28

- Data base update. Add rank and grah color to location.
Please run V006to007.sql available on http://static.frkb.fr/wdwapp
- Secure humidity reading. Cannot be below 1 or upper 100.
- Added detail view of last 24h data for a location.

- **0.0.6** 2017/12/26

- Beginning with the webserver.
A first page with last datas is available (in french sorry).
- Data base update. Add long description to server.
Please run V004to005.sql available on http://static.frkb.fr/wdwapp
- Removed tests.

- **0.0.4** 2017/12/25

- Remove return value.
- Change logging system to manage different levels (debug, error, warning,
etc.). In this way, for example, warnings can be send by mail from cron.
This implies mail option from log() have been removed.
- Suppress of backup file. Replaced by sensor_data table.
This table is indexed with sensor ID and timestamp so it is easier to
re-process data for a new sensor (re-process part need to be written).

- **0.0.3** 2017/12/22

- Rounding results to avoid truncate warning during database update.
- Avoid to insert already existing weather data.

- **0.0.1** 2017/12/21

First version.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wdwapp, version 0.0.8
Filename, size File type Python version Upload date Hashes
Filename, size wdwapp-0.0.8-py3-none-any.whl (33.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size wdwapp-0.0.8.tar.gz (24.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page