Skip to content

fadlytanjung/kodeland-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Forecast App

A simple weather forecasting application built using Flask, SQLAlchemy, and OpenWeather API. Users can register, log in, and view weather forecasts for any city. The app displays current weather details, including temperature and description, and allows users to check the weather for the next 3 days.

Features

  • User Authentication:

    • Registration: Allows users to create an account.
    • Login: Users can log in with their username and password.
    • Logout: Users can log out of their account.
  • Weather Forecast:

    • Users can input a city name to get weather data.
    • Displays the current weather (temperature, description).
    • Displays the weather forecast for the next 3 days (including daytime and nighttime temperatures).
  • Responsive Design: Built with Tailwind CSS for responsive design.

Tech Stack

  • Backend: Python, Flask
  • Database: SQLite (SQLAlchemy)
  • Weather API: OpenWeather API (or another free API if OpenWeather requires a subscription)
  • Frontend: HTML, CSS, Tailwind CSS
  • Environment Variables: .env file for configuration (e.g., API keys)

Installation

Prerequisites

Ensure you have the following installed:

  • Python 3.x
  • pip (Python package installer)
  • virtualenv (optional, for creating a virtual environment)

Steps

  1. Clone this repository:

    git clone https://github.com/your-username/weather-forecast-app.git
    cd weather-forecast-app
  2. Create a virtual environment (optional but recommended):

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    • Create a .env file in the root directory of your project.
    • Add the following lines to your .env file (replace with your actual credentials):
      WEATHER_API_KEY=your_openweather_api_key
      WEATHER_API_URL=https://api.openweathermap.org/data/2.5/forecast
      SECRET_KEY=your_secret_key
      DATABASE_URI=sqlite:///db.sqlite3
      
  5. Run the application:

    python app.py
  6. Access the app in your browser:

    http://127.0.0.1:5000
    

Usage

  1. Register:

    • Visit the registration page to create an account by providing a username, full name, and password.
    • If the username is already taken or passwords don't match, appropriate error messages will appear.
  2. Login:

    • Use the login page to log in with your username and password.
    • After successful login, you’ll be redirected to the homepage.
  3. Weather Forecast:

    • Enter the city name in the input field and press "Get Weather".
    • The app will display the current weather for that city, including temperature and description.
    • Below that, the 3-day weather forecast will show the date, day name (e.g., Monday), and both daytime and nighttime temperatures.
  4. Logout:

    • Click on the "Logout" link in the navigation bar to log out of your account.

Contributing

Feel free to fork this repository and submit pull requests for improvements or bug fixes. Please follow the code style used in the project.

License

This project is open-source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published