SimpleWeather is a Flask and MongoDB-based web application that provides users with current and weekly weather data for any city in the world. The application has evolved to include features like user registration, authentication, and the ability to save favorite cities. This project, being my first personal venture, has been an enriching experience, providing a deeper understanding of web development, databases, and user-centered design.
Follow these instructions to get the project up and running on your local machine for development and testing purposes.
- Python 3.6+
- Flask
- PyMongo
- Flask-Login
- WTForms
- bcrypt
- OpenWeatherMap API Key
- Clone the repository:
git clone https://github.com/JohnNtirintis/Weather-Application.git
- Navigate to the clone project directory:
cd Weather-Application
- Install the necessary packages::
pip install -r requirements.txt
To fetch the weather data, you'll need an API key from OpenWeatherMap.
- Sign up for a free account on OpenWeatherMap (if you don't already have one).
- Generate your API Key.
- Create a file named api-key.txt in the project's root directory.
- Paste your API key in the api-key.txt file.
- Save the file.
Start the application with the following command:
python -m flask --app main run
The application includes the following key features:
- Home Page ('/'): Displays the landing page of the application.
- Search Bar: Allows users to find weather forecasts for their desired city.
- IP-based Weather ('/weather/'): Provides weather data based on the user's IP address (accuracy may vary).
- City-specific URL ('/weather/<city_name>'): Shows current weather data for a specified city.
- User Registration and Login: Users can create accounts, log in, and save their favorite cities.
Note: An error message will be displayed if the weather data for a particular city is unavailable.
- Flask - The web framework used.
- MongoDB - The database used for user registration, login and favorite cities.
- OpenWeatherMap - The API used to get weather data.
- IPAPI - The IP tracker used to locate the user's city (accuracy may vary).
- WTForms - For form handling and validation.
- Flask-Login - For user authentication.
- bcrypt - For password hashing and verification.
This project marks my first step in the exciting journey of web development. I've learned a lot in the process and am eager to learn and build more. Your feedback is welcome and appreciated.