A beautiful and interactive weather dashboard application that provides real-time weather information and forecasts using the OpenWeatherMap API.
- Features
- Screenshots
- Installation
- Configuration
- Usage
- Project Structure
- Technologies Used
- API Integration
- Contributing
- License
- Real-time temperature with "feels like" perception
- Weather description with weather condition icons
- Location name and geographic coordinates
- 💨 Wind Speed - Displayed in m/s and km/h
- 👁️ Visibility - Shown in kilometers and meters
- 💧 Humidity - Percentage of moisture in the air
- 📊 Pressure - Atmospheric pressure in millibars
- ☀️ UV Index - Color-coded risk levels (Low, Moderate, High, Very High)
- 📊 24-Hour Forecast - Hourly weather predictions with temperature and precipitation chance
- 📅 5-7 Day Forecast - Daily predictions with high/low temperatures, humidity, and wind speed
⚠️ Weather Alerts - Active weather warnings and alerts (when available)
- Responsive Design - Works seamlessly on desktop, tablet, and mobile devices
- Beautiful Gradient Background - Modern purple gradient theme
- Interactive Cards - Hover effects and smooth animations
- Easy Search - Simple location search with city, state, and country inputs
The dashboard features:
- A prominent current weather display with large temperature and weather icon
- Four key metric cards showing wind speed, visibility, humidity, and pressure
- UV Index section with color-coded risk advisories
- 24-hour weather forecast with hourly predictions
- 5-7 day weather forecast with detailed daily information
- Python 3.8+
- pip (Python package manager)
- OpenWeatherMap API Key (free tier available)
git clone https://github.com/Johnson-journ1/Weather-Dashboard.git
cd Weather-Dashboard# On Windows
python -m venv venv
venv\Scripts\activate
# On macOS/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtThe main dependencies are:
- Flask - Web framework
- requests - HTTP library for API calls
- python-dotenv - Environment variable management
- Visit OpenWeatherMap
- Sign up for a free account
- Navigate to the API keys section
- Copy your API key
- Create a
.envfile in the project root:
touch .env- Add your API key to the
.envfile:
API_KEY=your_api_key_here
- The application will automatically load this key using
python-dotenv
# Make sure virtual environment is activated
python app.pyThe application will start on http://127.0.0.1:5000
- Open the browser and navigate to
http://localhost:5000 - Enter a location:
- City name (e.g., "London")
- State/Province code (optional, e.g., "10")
- Country code (optional, e.g., "GB")
- Click "Get Weather" to fetch weather data
- View the results:
- Current weather at the top
- Key metrics in the cards
- 24-hour forecast for hourly predictions
- 5-7 day forecast for longer-term planning
- UV index with health advisories
The dashboard comes pre-filled with "London, GB" as the default location for convenience.
Weather-Dashboard/
├── app.py # Flask application entry point
├── weather.py # Weather data fetching logic
├── requirements.txt # Python dependencies
├── .env # Environment variables (API key)
├── README.md # This file
├── templates/
│ └── index.html # Main dashboard UI
├── assets/
│ └── icons/ # Weather icons
├── data/
│ └── weather_history.csv # Historical weather data
├── tests/
│ ├── test_processing.py # Weather data processing tests
│ └── test_forecast.py # Forecast data tests
└── __pycache__/ # Python cache files
- Main Flask application server
- Handles HTTP routes (GET and POST)
- Manages template rendering
- Contains custom Jinja2 filters for date formatting
WeatherDatadataclass: Defines weather data structureget_lat_lon(): Fetches latitude/longitude from city nameget_current_weather(): Retrieves current weather conditionsget_forecast_data(): Fetches hourly and daily forecasts + UV indexmain(): Orchestrates all weather data collection
- Responsive HTML5 template
- Bootstrap 5 framework for styling
- Custom CSS for modern design
- Jinja2 templating for dynamic content
- JavaScript for client-side formatting
- Endpoint:
/data/2.5/weather - Purpose: Get current weather conditions
- Data Retrieved: Temperature, humidity, pressure, wind speed, visibility, weather description
- Endpoint:
/data/2.5/forecast - Purpose: Get 5-day forecast with 3-hour intervals
- Data Retrieved: Hourly temperatures, precipitation chance, weather icons
- Endpoint:
/data/2.5/uvi - Purpose: Get current UV index
- Data Retrieved: UV index value for sun protection recommendations
User Input (City, State, Country)
↓
get_lat_lon() → Fetch coordinates
↓
get_current_weather() → Current conditions
↓
get_forecast_data() → 24-hour & 7-day forecasts + UV index
↓
WeatherData object created with all data
↓
Rendered in HTML template
↓
Beautiful dashboard displayed to user
- Python 3.8+ - Programming language
- Flask - Web framework
- Requests - HTTP requests library
- python-dotenv - Environment variable management
- HTML5 - Markup language
- CSS3 - Styling with gradients and animations
- Bootstrap 5 - Responsive framework
- JavaScript - Client-side functionality
- Jinja2 - Template engine
- OpenWeatherMap API - Real-time weather data
- Git - Version control
- Virtual Environment - Python package isolation
| Range | Risk Level | Recommendation |
|---|---|---|
| 0-2 | Low | Wear sunscreen |
| 3-5 | Moderate | Use sunscreen |
| 6-7 | High | Extra protection needed |
| 8+ | Very High | Avoid sun exposure |
- m/s (meters per second) - Primary display
- km/h (kilometers per hour) - Conversion shown
- km (kilometers) - Primary display
- m (meters) - Detailed information
Run the test suite:
# Test weather data processing
python tests/test_processing.py
# Test forecast functionality
python tests/test_forecast.pyWe welcome contributions! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
This project is open source and available under the MIT License.
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing issues for similar problems
- Provide detailed information about the problem
Planned features for future versions:
- Multiple location favorites/bookmarks
- Weather alerts email notifications
- Historical weather data analysis
- Weather maps integration
- Air quality index (AQI)
- Pollen count data
- Precipitation radar
- Dark mode theme
- Multi-language support
- Never commit your
.envfile to version control - Keep your OpenWeatherMap API key private
- Use environment variables for sensitive data
- The API key should be stored in
.envand added to.gitignore
Last Updated: January 2026
Maintained by: Johnson-journ1
Enjoy using the Weather Dashboard! 🌈☀️🌧️