Loading repository data…
Loading repository data…
Subhasish18 / repository
Weather Flask App -- A simple, minimal, and responsive single-page weather application. The backend is built with Python and Flask, which serves a frontend built with vanilla HTML, CSS, and JavaScript. It fetches and displays real-time weather data from the OpenWeatherMap API.
A simple, minimal, and responsive single-page weather application. The backend is built with Python and Flask, which serves a frontend built with vanilla HTML, CSS, and JavaScript. It fetches and displays real-time weather data from the OpenWeatherMap API.
Weather_Flask/
├── app.py # The main Flask application and API logic
├── templates/
│ └── weather.html # The single-page HTML file for the UI
├── weather.db # SQLite database file (auto-generated)
└── README.md # This file
Follow these steps to get the application running on your local machine.
git clone <your-repository-url>
cd Weather_Flask
It's a best practice to use a virtual environment for Python projects.
# For Windows
python -m venv venv
.\venv\Scripts\activate
# For macOS/Linux
python3 -m venv venv
source venv/bin/activate
Create a requirements.txt file in the project root with the following content:
Flask
Flask-SQLAlchemy
Flask-Cors
requests
Then, install the packages:
pip install -r requirements.txt
The application uses an API key from OpenWeatherMap. While the key is currently hardcoded in app.py, the recommended approach is to use an environment variable.
Get your free API key from OpenWeatherMap. Then, you can either replace the hardcoded key in app.py or (preferably) set it as an environment variable and modify the code to read it.
python app.py
The application will start and be accessible at http://127.0.0.1:5000 in your web browser.