/weather-forecast-alert

🌈☁️Weather forecasts with chart display and notifications

Primary LanguagePythonMIT LicenseMIT

weather-forecast-alert

Build Status

Introduction

This Django web app can provide weather forecasts with chart display and notifications.

Features

  • Choose the city to get weather
  • Display current weather condition
  • Display current city map
  • Display Forecast as a chart(5 day / 3 hour forecast)
  • Set email notifications to notify the user if the temperature is below 45 °F

Demo

https://www.ranxiaolang.com/weather

If you find the online demo do not work, please follow the next part to run the code local.

Run the code local:

  1. Clone this repository:
git clone https://github.com/nature1995/weather-forecast-alert.git
  1. Enter into weather-forecast-alert folder, set up virtual environment with python 3.6 and install packages.
 cd weather-forecast-alert
 pip3 install -r requirements.txt
  1. Update API key

OpenWeatherMap API key:
OWM_API_KEY: ./weather-forecast-alert/apps/weather/views.py

Email key: (See email to find the latest key)
EMAIL_HOST_PASSWORD: ./weather-forecast-alert/Weather/settings.py

  1. Run server on your own computer:
python manage.py runserver 0.0.0.0:8000
  1. Access though browser
http://127.0.0.1:8000
or
http://0.0.0.0:8000

Result

  1. Weather forecasts with chart display
Result01.png Result03.png Result02.png
  1. Notifications though email
Result04.png Result05.png
  1. Show figure with Smoothed Line Chart or Histogram
Result06.png Result07.png

Notice:

OpenWeatherMap API key:
OWM_API_KEY: ./weather-forecast-alert/apps/weather/views.py

Google Map API key:
GOOGLE_MAP_KEY: ./weather-forecast-alert/apps/weather/views.py

Set your Email:
Location: ./weather-forecast-alert/Weather/setting.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.exmail.qq.com'
EMAIL_PORT = 465  # Your send port
EMAIL_HOST_USER = 'weather@ranxiaolang.com'
EMAIL_HOST_PASSWORD = 'Your Password'  # Use the dedicate password not your email password
EMAIL_USE_SSL = True  # SSL or TSL depend on email provider

Author

nature1995 | Ziran Gong