Skip to content

cawhyte7/parity-server

 
 

Repository files navigation

parity-server Build Status

OCUA Parity League server code.

production: https://parity-server.herokuapp.com/

Server Setup

  1. You will need python (version 3) (with pip) and sqlite on your local machine.
  2. To install python dependencies run pip install -r requirements.txt (You may need Run as administrator depending on your security settings)
  3. Start the python server with this command python server/app.py
  4. Create your database by running python server/init_db.py and then seed it with python server/seed.py
  5. You can inspect the server responses at http://localhost:5000/weeks/1 and http://localhost:5000/stats etc.

On production the python server serves a static build of the client. This can be tested locally by running yarn build and then visiting localhost:5000.

Client Setup

  1. You will need to install node on your computer
  2. Install yarn by running the command npm install -g yarn
  3. Install the javascript dependencies by running yarn install
  4. Start the client by running yarn start. It will open a browser window with the app running on your computer. If you make changes to the code the window will reload with the changes.

Note that the client connects to the production server by default. This is safe to do because the client is read-only. This enables an easier development experience for anyone working only on the frontend. If you need to connect to a local server update the proxy to point to the local server http://localhost:5000 in the client/package.json file.

Visual Studio 2017

Additional notes for those using Visual Studio 2017, depending on the selected workload

  • VS2017 installs an older version of node. Get the latest version, then ensure it is referenced correctly in the path by going to Tools->Options->Projects and Solutions->Web Package Management->External Web Tools, then add the Node install directory to the top of the list
  • VS2017 installs Python36 at C:\Program Files. Be sure to add C:\Program Files\Python36 and C:\Program Files\Python36\Scripts to your PATH

Testing

To test locally by uploading a json file run:

curl -X POST --data @data/test/one.json -H "Content-Type: application/json" http://localhost:5000/upload

To reset your local database delete the db.sqlite file and restart the python server.

There is also an automated test suite which can be run using the python test.py.

Operations

This app is deployed to Heroku.

To create the database run heroku run python server/init_db.py

To sync teams from Zuluru run heroku run python server/zuluru_sync.py

To backup the database (only the raw games data the rest is calculated by the app) run python server/backup.py

To seed the production database uncomment the production url in server/seed.py and run the script locally python server/seed.py

Contributing

PRs welcome!

If you are interested in contributing (especially if you play in the league!) Feel free to contact me first if you need any help or have questions.

contact: kevinhughes27@gmail.com

About

OCUA Parity League backend and public interface

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 50.6%
  • JavaScript 42.7%
  • CSS 4.1%
  • HTML 2.6%