- Redis server running (for rq workers)
- Python 3.9+
- A weather API key (OpenWeatherMap recommended).
- Set WEATHER_API_KEY env var.
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
WEATHER_API_KEY : your weather API keyWEATHER_CITY : default city (optional)DATABASE_URL : optional (default sqlite:///weather.db)REDIS_URL : redis://localhost:6379/
$ export FLASK_APP=src/app.py
$ flask run
Start the RQ worker (in separate terminal):
$ python worker.py
Fetch from the web UI (POST /fetch) or use Python to enqueue:
from tasks import enqueue_fetch_weather
enqueue_fetch_weather('London')
$ pytest -q
- For production, configure proper secret key and production-ready DB.