This repository contains a Flask-based web application that provides real-time weather information. It utilizes the OpenWeather API to fetch the current temperature in both Celsius and Fahrenheit, along with the location name based on the user's geographical coordinates.
- Geolocation Support: Automatically fetches the user's current location.
- Weather Data: Displays the temperature in Celsius and Fahrenheit and the name of the location.
- Responsive Design: Simple and responsive user interface.
To run this application, you'll need Python and Flask installed on your machine.
-
Clone the Repository
git clone [repository URL] cd [repository folder]
-
Install Dependencies
This application requires Flask and requests. You can install them using pip:
pip install Flask requests python-dotenv
-
Set Up Environment Variables
Create a
.env
file in the root directory and add your OpenWeather API key:OPENWEATHER_API_KEY=your_api_key_here
-
Run the Application
python app.py
The application will start running on
http://localhost:5000
.
Navigate to http://localhost:5000
in your web browser. The application will automatically request your location and display the current weather data.
app.py
: Main application file where Flask routes are defined.weather_service.py
: Contains theWeatherService
class that handles API requests.templates/
: Folder containing HTML templates.index.html
: Front-end HTML structure.
Feel free to fork this project, make changes, and open a pull request to contribute. Contributions, issues, and feature requests are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.