Skip to content

Latest commit

Β 

History

History
69 lines (52 loc) Β· 2.38 KB

File metadata and controls

69 lines (52 loc) Β· 2.38 KB

🌦️ Weather API Django Web App

A simple and elegant Django-based web application that fetches and displays real-time weather data from the OpenWeatherMap API.

πŸ“– Project Description

This project allows users to get the current weather information for any city in the world. It's built with Django and uses the OpenWeatherMap API to fetch real-time data. This application is a great starting point for anyone looking to build a web app with Django and integrate with a third-party API.

πŸš€ Features

  • Real-Time Weather Data: Get up-to-date weather information.
  • Search by City: Users can search for any city to get weather details.
  • Detailed Information: Displays temperature, humidity, pressure, weather conditions, and coordinates.
  • User-Friendly Interface: A clean and simple UI for easy use.
  • Error Handling: Gracefully handles invalid city names and API errors.

πŸ“¦ Requirements

  • Python 3.8+
  • Django 4+
  • Requests

βš™οΈ Installation Guide

  1. Clone the Repository:

    git clone [https://github.com/your-username/weather-api.git](https://github.com/your-username/weather-api.git)
    cd weather-api
  2. Create a Virtual Environment:

    python -m venv venv

    Activate the environment:

    • Windows: venv\Scripts\activate
    • macOS/Linux: source venv/bin/activate
  3. Install Dependencies:

    pip install -r requirements.txt

    (Note: You'll need to create a requirements.txt file. See the section below.)

  4. Get Your API Key:

    • Go to OpenWeatherMap and create a free account.
    • Navigate to the "API keys" tab and get your API key.
  5. Set Up Environment Variables:

    • In wheatherapp/settings.py, add the following line at the end of the file:
      WEATHER_API_KEY = 'your_openweathermap_api_key'
    • Important: For a production environment, it's recommended to use environment variables to keep your API key secure.
  6. Apply Migrations:

    python manage.py migrate
  7. Run the Server:

    python manage.py runserver

    The application will be running at http://127.0.0.1:8000/.

requirements.txt

Create a file named requirements.txt in the root of your project and add the following lines: