Skip to content

daney23/WeatherApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capyWeather

A simple Flask web app that displays a 7-day weather forecast for any location, powered by WeatherAPI.com. Built as the final project for a DevOps bootcamp — the goal was to take a small Python app from source all the way to a production-style deployment using containers, a reverse proxy, and a systemd-managed service.

Tech stack

  • Backend: Python 3.9, Flask
  • Templating: Jinja2
  • Production server: Gunicorn
  • Reverse proxy: Nginx
  • Container: Docker (multi-stage build)
  • Process manager: systemd (for bare-metal deploy)
  • External API: WeatherAPI.com

Screenshot

Add a screenshot of the running app here, e.g. ![capyWeather screenshot](docs/screenshot.png)

Prerequisites

  • A free API key from WeatherAPI.com
  • For local dev: Python 3.9+
  • For container deploy: Docker
  • For systemd deploy: Ubuntu (or any systemd-based Linux), Python 3, pip

Environment variables

Variable Required Description
WEATHER_API_KEY Yes Your API key from WeatherAPI.com

Run locally

pip install -r requirements.txt
export WEATHER_API_KEY=your_key_here   # PowerShell: $env:WEATHER_API_KEY="your_key_here"
python app.py

Visit http://localhost:5000.

Deploy with Docker

Pull and run the pre-built image:

docker run -dti -p 80:80 -e WEATHER_API_KEY=your_key_here danos23/weatherapp:final

Or build from source:

docker build -t capyweather .
docker run -dti -p 80:80 -e WEATHER_API_KEY=your_key_here capyweather

Deploy on a server with systemd + Nginx

  1. Copy the project files to your target machine (e.g., /home/ubuntu/web-app).
  2. Install Python and pip:
    sudo apt install python3 python3-pip
  3. Install the Python dependencies:
    pip3 install -r requirements.txt
  4. Set the API key (e.g., in /etc/environment or a systemd Environment= directive).
  5. Install the systemd unit:
    sudo cp gunicorn_webapp.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable --now gunicorn_webapp
  6. (Optional) Drop nginx.conf into /etc/nginx/conf.d/ and reload Nginx to expose the app on port 80.

Project layout

web-app/
├── app.py                       # Flask application
├── templates/
│   ├── layout.html              # Base template
│   └── home.html                # Forecast view
├── Dockerfile                   # Multi-stage Python -> Nginx image
├── nginx.conf                   # Reverse proxy config
├── gunicorn_webapp.service      # systemd unit
├── requirements.txt             # Python dependencies
└── README.md

About

7-day weather forecast Flask app — Dockerized, Nginx-fronted, deployable via systemd. DevOps bootcamp project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors