This is a Dash application that uses the open-meteo APIs (https://open-meteo.com/en/docs) to show some interesting plots.
Install the requirements
dash
dash-bootstrap-components
, for styling the whole applicationdash-mantine-components
, for the new styling componentsdash-iconify
, for the new iconsdash-leaflet
, to show the small mappandas
, for data manipulationplotly
, for plottingrequests
, used to download data from the openmeteo APIflask-caching
, used to cache all data functionsjdcal
, forsuntimes.py
to work. We use this to show the sunrise/sunset times on the plot.Pillow
, to add weather icons
Sorry, no explicit packaging with yaml
and/or requirements.txt
is provided for now.
But since you only need a few packages to make it work, it should be fine.
You can set the options in src/utils/settings.py
APP_HOST
,APP_PORT
will only have effect if you run theapp.py
directly without using another production server likegunicorn
URL_BASE_PATHNAME
specifies the subfolder where the whole site is runningCACHE_TYPE
andCACHE_DIR
allows you to change the cache behaviour, which is used to save and reuse the results of the function downloading the forecast data insrc/utils/openmeteo_api.py
To test just run python src/app.py
.
To deploy in production something like this should work
gunicorn -b 127.0.0.1:8000 --timeout=90 app:server
You can setup a service using systemd
[Unit]
Description=Gunicorn instance to serve point_wx
After=network.target
[Service]
User=user
Group=group
WorkingDirectory=/home/user/point_wx/src
Environment="MAPBOX_KEY=<mapbox-key-for-geocoding-api>"
Environment="OPENMETEO_KEY=<commercial-key-otherwise-free-is-used>"
Environment="REACT_VERSION=18.2.0" # Needed for dash mantine
ExecStart=/bin/bash -c "source /home/user/miniconda3/bin/activate dash && exec gunicorn -b 127.0.0.1:8000 --workers=3 --timeout=90 --preload app:server"
StandardOutput=append:/var/log/pointwx/point_wx.log
StandardError=append:/var/log/pointwx/point_wx.log
[Install]
WantedBy=multi-user.target
Or with Docker
docker build -t pointwx .
docker run -p 8083:8000 -it -e MAPBOX_KEY=<mapbox-key-for-geocoding-api> -e OPENMETEO_KEY=<commercial-key-otherwise-free-is-used> pointwx