Skip to content

Infopercept/python-weather-app

Repository files navigation

Weather App

This Weather App is a Flask-based web application that provides weather forecasts using the OpenWeatherMap API.

Getting Started

These instructions will guide you through setting up and running the application on your local machine.

Prerequisites

  • Python 3
  • pip (Python package manager)
  • Access to the terminal or command line interface

Installation

Follow these steps to get your development environment running:

Step 1: Clone the Repository

Clone this repository to your local machine:

git clone git@github.com:Infopercept/python-weather-app.git
cd python-weather-app

Step 2: Create a Virtual Environment

Create a virtual environment in the project directory:

# For Unix or MacOS
python3 -m venv venv

# For Windows
python -m venv venv

Step 3: Activate the Virtual Environment

Activate the virtual environment:

# For Unix or MacOS
source venv/bin/activate

# For Windows
.\venv\Scripts\activate

Step 4: Install Dependencies

Install the required packages using pip:

pip install -r requirements.txt

Step 5: Set Up the Environment Variable

Set up the OWM_API_KEY environment variable with your OpenWeatherMap API key:

# For Unix or MacOS
export OWM_API_KEY='your_api_key_here'

# For Windows
set OWM_API_KEY=your_api_key_here

Step 6: Run the Application

Run the Flask application:

python main.py

Accessing the Application

Once the application is running, open your web browser and navigate to http://localhost:5000 to view the Weather App.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Screenshots (Desktop)

Screenshots (Mobile)

Reflection

Building a Python project from scratch without relying on a tutorial taught me a lot but I was also able to implement the app's key functionality (getting and displaying weather data) due to the work I did with APIs in Angela Yu's Python bootcamp. While deploying this web app, I learned about git and version control as well as storing API keys as environment variables with .env and the purpose of .gitignore. This project turned out to be frustrating and complicated at times but I learned and grew a lot as a developer by tackling each problem. For instance, I struggled to make this website responsive because I discovered that the Chrome browser tools are not entirely accurate for the mobile view. Hence, when the app was deployed, the website didn't look the way I expected ore desired on mobile. So I switched to a free desktop application called Responsively and it provided views for multiple devices which allowed me to improve my CSS. In addition, I had difficulty positioning my footer at the bottom of my page and had to refer to this resource to adjust my CSS accordingly.

If I were to do this project again, there are a few changes I would make. I would make the website render beautifully on iPads as well by eliminating the space between elements. I also wasn't sure how to add more functionality to this app while maintaining a seamless UI/UX design this time and I would love to do so in the future. E.g. I could add an option for users to specify the country of the city they enter (if multiple countries share the same city name). I could also display the low and high temperatures for each day in the five day forecast instead of only displaying the temperature at noon (which I understand is not an accurate estimate of the overall temperature). It would also be useful to enable location detection to allow the user to get more accurate weather data for their current location by using their precise coordinates instead of relying on the geocoding API provided by OpenWeather.

Useful Resources

Image Credit

Icons

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published