/wqu-s202101-project

Collaborative project for WQU students in the winter 2021 session

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

WQU Collaborative Project

This project demonstrates how to use Python to create web applications. It is primarily meant for educational purposes, specifically created for the WorldQuant University - Introduction to Data Science Module of the winter 2021 session.

The skills and tools used are:

  • Python's requests package.
  • Python's flask web framework.
  • working with JSON.
  • modular programming.

When a client visits the application, it:

  1. gets the client's IP address.
  2. uses the IP address to look up their location.
  3. uses their location data to tell them when the sun will set.

Prerequisites

All required Python packages can be found in the requirements.txt file. Additionally, the provided Makefile can be used to create a virtual environment by running make venv. You will also need a Heroku account, and to have installed the Heroku CLI.

Running the app locally using Flask

You may want to run the app using Flask locally before deploying it to Heroku, especially if you have made any changes to the code. To run locally (with a Unix-like OS):

  1. clone the repository.
  2. in the repository, run make deploy.
  3. open the link provided in the command line.

If you are using Windows, you can:

  1. create and activate the virtual environment.

     py -3 -m venv venv
     venv\Scripts\activate.bat
    
  2. set FLASK_APP=wqu_app/app.py in the command line.

  3. set Flask_ENV=development in the command line.

  4. run python -m flask run.

  5. open the link in the command line.

Alternatively, you can deploy using Docker.

  1. docker build -t wqu_app .
  2. docker run -d -p 5000:5000 wqu_app

Deploying to Heroku

Make sure your app is ready to be deployed to Heroku by running Flask locally. To deploy to Heroku:

  1. clone the repository (if you haven't yet).
  2. heroku login and enter your credentials.
  3. heroku create or heroku create app-name where app-name is a custom app name.
  4. git push heroku master.
  5. heroku config:set DEPLOY=heroku.
  6. heroku open or open the app online through your Heroku profile.

Future work

Since this is a short demonstration of what you can do using Python to create web applications, consider extensions to the project. Some ideas include:

  1. showing a plot of the forecast.
  2. using their location to display other location specific data.

Contributing to this project

Please see the contributing guidelines found in CONTRIBUTING.md.

Contributors

Thanks to the following people who have contributed to this project:

License

This project is distributed under the GNU General Purpose License. Please see LICENSE for more information.