A web application that shows various useful information for the office, like upcoming events and a leaderboard counting the number of Github commits.
Either grab the credentials.py
file from the TechX Google Drive, or follow the instructions below.
First create a credentials.py
in the root directory of the project. The contents of the file look like this:
# Github Token
token = ""
# Calendar
refresh_token = ""
client_id = ""
client_secret = ""
The Github token can be obtained from any account with access to ORG_NAME
by going to https://github.com/settings/tokens. Make sure to check the repo
scope while issuing the token.
The calendar fields can be obtained by first registering an app at the Google Developer Console. This will give you the client_id
and client_secret
.
To obtain a refresh token, add https://developers.google.com/oauthplayground to the list of redirect URI's of your app. Then head over to the Google OAuth Playground, add the https://www.googleapis.com/auth/calendar.readonly
in the list of scopes and hit Authorize API.
This needs to be done from a google account that has access to the ORG_NAME
calendar. The click the Exchange auth code for tokens
button and grab the refresh_token
Execute,
pip install -r requirements.txt
You may have to use system specific package managers to resolve a few dependancies. (For instance, you need to use fedora's package manager to get six.)
Then run,
python app.py
This app uses sticky sessions and a persistant background thread and storage. Use appropriate deployment methods. The default run uses Flask's internal wsgi server. You can use a production ready server like gunicorn with only a single worker thread as well,
gunicorn -w 1 -b 0.0.0.0:80 app:app
MIT License