jctim / aqi-statreq-web

AQI Station Requestor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AQI Station Requestor

A simple service aimed to search AQI stations by city name via interacting with AQI API service https://aqicn.org/api/

Table of contents

Why this code appeared

  • Write a simple backed service for the settings page of Garmin Watch widget "Air Quality Index"
  • Playing with python and learning docker

Set up configuration

  1. Create your own config file token.ini based on example token.ini.template and set your API token generated on this page http://aqicn.org/data-platform/token/#/

Run on local env

(bash) $ PORT=8080 && python3 app/main.py

or

(fish) > set PORT 8080; and python3 app/main.py

Run as docker container

Build

  1. Install docker :
$ brew install docker

Then you may build the image locally or pull it from the Docker Hub

  • Build image locally
$ docker build --rm -t jctim/aqi-statreq:latest .
  • Pull image from the Docker Hub
$ docker pull jctim/aqi-statreq:latest .

Run

$ docker run \
  -v $(pwd)/token.ini:/opt/aqi-app/token.ini \ 
  -v $(pwd)/info.log:/opt/aqi-app/info.log \ 
  --env PORT=5001 -p 8080:5001 \ 
  --name my-aqi-statreq \ 
  jctim/aqi-statreq

Observe in browser

http://localhost:8080/station

About

AQI Station Requestor

License:GNU General Public License v3.0


Languages

Language:Python 45.6%Language:HTML 43.7%Language:Dockerfile 10.6%