codingwithjen / capstone-1

A weather forecast app built with Python and Flask, using PostgreSQL, and fetching weather conditions via OpenWeather API

Home Page:https://weatherflasksearch.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weather Flask Search

Live Demo/Deployed Web App: https://weatherflasksearch.herokuapp.com/

External API Used: https://openweathermap.org/api

Description

A weather forecasting web application that allows users to see the conditions, forecast, temperature, and other related metrics based on the user's desired location, as well as a number of other cities. Users can create an account to bookmark cities at their leisure, and can continue tracking those cities via a dashboard. The web app performs an API call to a third-party resource to acquire weather data on each city searched, and the web applicaiton stores user information and bookmarks on our database.

Features

  • jQuery Ajax used to fetch current weather conditions, along with a five-day weather forecast for the particular city searched by the user, without the need of redirecting user to a new page with results; faster response, no need for page to reload
  • Functionality to bookmark and remove cities built using CRUD operation
  • Usage of Flask-SQLAlchemy to build Database to store user information, and to keep track of the user's dashboard, which contains bookmarked cities with current weather data information fetched from the external API
  • Usage of Flask-Bcrypt for user Authorization and Authentication, and password security
    • Login and registration handled on server-side with the use of Flask and WTForms
    • Can bookmark cities to easily access them via their dashboard, once the user is logged in
    • An account is not required to search weather data
  • Usage of {{ mustache }} templating, along with Jinja templating
  • Flask sessions used to keep track of users, whether registered or anon-user
  • Deployment with Heroku, and adding a Postgres Database

Features in Development

  • Ability to reset password if the user forgot crendentials
  • Ability to delete the user's account
  • Ability to include an autocomplete search bar with all US cities
    • Only US cities, due to just wanting to use OpenWeatherMap API and having a csv file of us_cities imported into seed.py file

Set Up

First, Git Clone the Repo in Command Line (Instructions for Mac Users):

  1. cd to your desired location, and git clone https://github.com/codingwithjen/capstone-1.git
  2. Create a venv file: python3 -m venv venv
  3. Activate the virtual environment before installing any libraries via pip source venv/bin/activate
  4. Once activated, pip install -r requirements.txt
  5. Sign up via OpenWeather for an API key - I have hidden this in my .gitignore file and via dotenv
  6. Once all the packages are installed, export FLASK_ENV=development and then ENTER (can set this once per terminal) and flask run and open your local server
  7. Once you hit ENTER, type in flask run
  8. Since I used an npm package, you can install that package by adding this into your root project directory npm install axios

Screenshots

Homepage below: Homepage of Weather Flask Search Dashboard if you are a registered user: Dashboard of Weather Flask Serach

Tech Stack

Languages:

  • HTML5
  • CSS
  • Python3
  • JavaScript
  • SQL
    • PostgreSQL

Libaries/Tools:

  • Flask
  • jQuery AJAX
  • Bootstrap
  • Bcrypt
  • SQLAlchemy
  • Flask-DebugToolbar
  • WTForms
  • Jinja
  • requests
  • npm
    • {{ mustache }}

Versions Used

  • Python --version 3.9.6
  • PostgreSQL v13
  • All else found in requirements.txt, runtime.txt, Profile

Sources:

  1. [user_obj.is_authenticated] (https://www.rithmschool.com/courses/intermediate-flask/authentication-with-flask-login)
  2. [Unique Index] (https://forum.inductiveautomation.com/t/insert-into-database-only-if-the-entry-doesnt-exist/35122/10)
  3. [mustache.js] (https://www.npmjs.com/package/mustache)
  4. [cdnjs.cloudflare.com] (https://cdnjs.cloudflare.com/)
  5. [Google Hosted Libraries] (https://developers.google.com/speed/libraries)

Credit:

  1. [kammybdeng] (https://github.com/kammybdeng/weather_flask_webapp)
  2. [AgrimNautiyal] (https://github.com/AgrimNautiyal/flask-weather-app)
  3. [dtdkhoi] (https://github.com/dtdkhoi/WeatherDashboard)
  4. [Pretty Printed vid] (https://www.youtube.com/watch?v=lWA0GgUN8kg)

About

A weather forecast app built with Python and Flask, using PostgreSQL, and fetching weather conditions via OpenWeather API

https://weatherflasksearch.herokuapp.com/


Languages

Language:HTML 48.1%Language:Python 47.5%Language:JavaScript 3.1%Language:CSS 1.3%Language:Procfile 0.1%