Welcome to the Weather Forecast App! This application provides real-time weather forecasts using the OpenWeatherMap API. It allows you to fetch weather data, view charts, and store data in a local database for quick access.
- Real-Time Weather Data: Fetch current, minutely, hourly, and daily weather forecasts.
- Interactive Map: Select a location on the map to get weather data.
- Weather Charts: Visualize hourly and daily weather data with interactive charts.
- Local Storage: Store weather data in a local SQLite database to reduce API calls.
- Time-Sensitive Data: Automatically update weather data if it's older than 10 minutes.
- Admin Panel: Manage and view stored weather data through Django's admin interface.
- Django: The web framework used to build the application.
- Django REST Framework: For building the API endpoints.
- OpenWeatherMap API: To fetch real-time weather data.
- Plotly: For creating interactive weather charts.
- Google Maps API: For the interactive map to select locations.
- SQLite: The database used to store weather data locally.
-
Clone the Repository
git clone https://github.com/yourusername/weather-forecast-app.git cd weather-forecast-app
-
Create a Virtual Environment
python -m venv .venv source .venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Set Up Environment Variables Create a .env file in the project root and add your
OpenWeatherMap API key:
OPENWEATHER_API_KEY=your_openweather_api_key
-
Run Migrations
python manage.py migrate
-
Start the Development Server
python manage.py runserver
-
Access the Application
Open your browser and go to
http://127.0.0.1:8000/
. -
Get Weather Data
- Click on the map to select a location.
- Fill in the latitude, longitude, and data type (current, minutely, hourly, daily).
- Click "Get Weather" to fetch and display the weather data.
- View Weather Charts
- Fill in the latitude, longitude, and select hourly or daily forecast.
- Click "Get Weather Chart" to generate and view the interactive weather chart.
- Get Weather Data
GET /api/weather/?lat={lat}&lon={lon}&data_type={data_type}
- Get Weather Chart
GET /chart/?lat={lat}&lon={lon}&data_type={data_type}
-
Access the Admin Panel
Go to `http://127.0.0.1:8000/admin/ and log in with your admin credentials.
-
Manage Weather Data
- View and manage stored weather data.
- Check timestamps and data types to ensure the data is up-to-date.
We welcome contributions! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Commit your changes with descriptive messages.
- Push your changes to your forked repository.
- Create a pull request with a detailed description of your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or need assistance, feel free to contact me at [email protected].
Thank you for using the Weather Forecast App! We hope you find it useful. π€οΈπ§οΈβοΈ