Giter Site home page Giter Site logo

fras2560 / wjl Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 885 KB

Waterloo Jam League

Home Page: https://waterloo-jam-league.fly.dev

License: Apache License 2.0

Python 28.08% CSS 3.94% HTML 44.35% JavaScript 1.89% TypeScript 18.18% Gherkin 3.54% Procfile 0.01%
kan jam sports waterloo

wjl's Introduction

Waterloo Jam League (wjl)

This repository is for the Waterloo Jam League. A fun little Kan Jam league due to most sports being closed for the time being. This app was a repository I created to allow people to submit their game scores and to keep track of schedule/standings. Also, I got to try some new things out.

Assumed Dependencies:

  • python
  • npm

Python Webapp

TLDR

    # install all python requirements
    pip install -r requirements.txt
    # export following if plan on testing locally
    export ARE_TESTING=True
    # allow for oauth from http
    export OAUTHLIB_INSECURE_TRANSPORT=1
    export OAUTHLIB_RELAX_TOKEN_SCOPE=1
    python runserver.py

This will use an in-memory database. To actually test with a PostGres database one just needs to setup the appropriate environment variables.

Environment Variables

The following variables are used by wjl and the defaults are in brackets:

  • DATABASE_URL: the database url to connect to ("sqlite://")
  • SECRET_KEY: the secret key for the app (random uuid1)
  • GOOGLE_OAUTH_CLIENT_ID: the Google OAuth client id (default off)
  • GOOGLE_OAUTH_CLIENT_SECRET: the Google OAuth secret (default off)
  • FACEBOOK_OAUTH_CLIENT_ID: the Facebook OAuth client id (default off)
  • FACEBOOK_OAUTH_CLIENT_SECRET: the Facebook OAuth client secret (default off)
  • GITHUB_OAUTH_CLIENT_ID: the Github OAuth client id (default off)
  • GITHUB_OAUTH_CLIENT_SECRET: the Github OAuth client secret (default off)
  • ARE_TESTING: True if testing using Cypress (default False)

The various OAuth providers are off by default and one has to setup the client/secret for their local development.

Database

One like wants persistence data for testing locally. First create a PSQL database and set its URL in an environment variable

export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/<DATABASE_NAME>

Now calling python initDB.py will create the database schema.

Adding OAuth Provider

This can be a bit of a pain. The easiest one to setup is Github (good for local development).

Github

Visit here to register an application on GitHub. You must set the application's authorization callback URL to http://localhost:5000/login/github/authorized.

Once you've registered your application on GitHub, GitHub will give you a client ID and client secret, which we'll can be set using

export GITHUB_OUATH_CLIENT_ID=<YOUR ID HERE>
export GITHUB_OUATH_CLIENT_SECRET=<YOUR SECRET HERE>

Google

I was unable to get this working locally. See here for how it was setup in production.

Facebook

I was unable to get this working locally. See here for how it was setup in production.

Github Actions

When doing a pull-request to the master branch some checks are executed using Github actions. These actions are to ensure the changes in the PR do not break anything. The following is executed:

  1. Check the Python code for any flake8 issues
  2. Run the webapp
  3. Run the Cypress tests against the webapp

Cypress Testing Locally

TLDR

    cd cypress-testing
    # install all dependencies
    npm install
    # set application URL
    export CYPRESS_baseUrl=<Application URL: http://localhost:5000>
    # run the cypress app then choose test
    npm run open
    # run all tests
    npm run test

See the Readme in cypress-testing folder for more details.

Additional Sources

Python Resources

JavaScript Resources

  • jQuery - used for some basic pages
  • Boostrap - CSS framework
  • Vue - used for the score app and other more complex UI
  • Cypress - documentation for Cypress
  • TypeScript - a super set of JavaScript

wjl's People

Contributors

fras2560 avatar glifchits avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

wjl's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.