Project Swagger Documentation: https://leaderboard-project.herokuapp.com/docs/
- Create a virtual environment with Python3.7:
virtualenv env -p python3.7
. If you dont havepython3.7
yet then you can install it with:- linux(ubuntu/debian) -
sudo apt install python3.7
- windows - Download installer from https://www.python.org/downloads/release/python-370/.
- linux(ubuntu/debian) -
- Activate the virtual environment:
source env/bin/activate
- Install all the dependencies in
requirements.txt
file:pip install -r requirements.txt
- Make a copy of
.env.sample
to.env
and change the values of variables with original values. Click here for sample .env file. - Migrate the migrations:
python manage.py migrate
- See below for webhooks setup.
- Run the app:
python manage.py runserver
- To test the APIs in your local, we can use ngrok See below for ngrok setup.
- Navigate to http://localhost:8000/docs/ for the swagger UI documentation in your browser.
- When you are done using the app, deactivate the virtual environment:
deactivate
SECRET_KEY='w0fcvcq02wh!yqiewq7)n^b7med(xop6h^@-_3j01*m0m)nz1)'
GOOD_FIRST_ISSUE_POINTS = 10
MEDIUM_ISSUE_POINTS = 20
HARD_ISSUE_POINTS = 40
OAUTH_CLIENT_ID = 'oauth_client_id'
OAUTH_CLIENT_SECRET_KEY = 'oauth_secret_key'
- Install ngrok
- When you're done installing, you can expose your localhost by running
./ngrok http 8000
. - Copy that funky
*.ngrok.io
URL. That's your server public URL for now.
We recommend you go through Webhooks Docs to be able to use this project effeciently.
- Select any repo and head over to https://github.com/:owner/:repo/settings/hooks/new
- Create a webhook with payload URL (ngrok or real server) with
/pull_request/
appended to it. - Set the content type as
application/json
. No secrets for now. - Select the individual event called "Pull Requests". Let the webhook be
Active
. - Make another similar webhook with payload URL
/issue/
appended to it, and select the event "issues". - Also create a new Leaderboard object in the admin panel or Python shell with the, username same as the github username you are making your PRs with.
This repository has been created while keeping some good coding practices and situational advantages, and so the following needs to be kept in mind while working with it.
We keep track of merged PRs and total PRs made by each user. For scoring purposes we have divided the issues into three categories. These categories are identified by adding labels to the issues.
- Good first issue - These are simpler issues to get you started.
- Medium issues - These are mildly challenging and worthwhile.
- Hard issues - These are definitely meant to challenge you.
We understand that each contribution is itself of great importance. So we have decided to reward all those participants who solve atleast 2 medium issues and 1 good first issue. This is taken care of by the boolean milestone_achieved
.
For every issue closed, we increment points. The following needs to be kept in mind in practice.
- Every issue is assigned to one user only (This is important for proper points distribution and less confusion in the repository.)
- Every issue is solved only by the user assigned to it. The person making the PR must ensure that s/he has been assigned the issue to make sure his/her contribution is counted.
- Each issue shall contain only one of the labels described above.
- Make sure the user is registered before the PR is made for proper updation, as updation is instant.