OCUA Parity League server code.
production: https://parity-server.herokuapp.com/
- You will need
python
(version 3) (withpip
) andsqlite
on your local machine. - To install python dependencies run
pip install -r requirements.txt
(You may need Run as administrator depending on your security settings) - Start the python server with this command
python server/app.py
- Create your database by running
python server/init_db.py
and then seed it withpython server/seed.py
- You can inspect the server responses at
http://localhost:5000/weeks/1
andhttp://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.
- You will need to install node on your computer
- Install
yarn
by running the commandnpm install -g yarn
- Install the javascript dependencies by running
yarn install
- 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.
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
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
.
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
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