|Prasanna Venkadesh 50a9d15292 added docstrings||2 months ago|
|static||2 months ago|
|templates||2 months ago|
|LICENSE||2 months ago|
|README.md||2 months ago|
|app.py||2 months ago|
|background_runner.py||2 months ago|
|cron_sample||2 months ago|
|leaderboard.sql||2 months ago|
|requirements.txt||2 months ago|
Note: Python 3.6 is required to run the
background_runner.py file as it is written asynchronously using the Python's new famous standard library called
aiohttp. At the time of writing this document,
python3.6 has to be manually compiled from source code. Compiling python from source is not a daunting task, if you installed the dependent libraraies properly.
This blog should be helpful to do that.
Installing Dependencies for osm-leaderboard
pip3.6 install -r requirements.txt
I have used sqlite3 for data-storage at the backend as it is light-weight and is more than sufficient for this kind of applications. Create the database by running the following command. Make sure, you have
command line interface installed.
sqlite3 data.sqlite3 < leaderboard.sql
If you give a different name for the sqlite3 database file, make sure you change in the python file too (both
Starting the application
You might be organizing your mapathon starting from a particular date. This date has to be set in the
EVENT_DATE variable in the file
app.py, before proceedin further.
for deploying in production or realtime, you can use any one of the multi-threaded, mutli-processing libraries like
gevent. I prefer installing
pip and starting the application like the following
gunicorn -D -w 2 -b 127.0.0.1:8787 app:app
The app should now be started and running. You can access the application by visiting http://localhost:8787 in your browser.
Registration is a 2 step process.
The actual updates to leaderboard will happen only via
background_runner.py program. This file has to be invoked using python3.6 (not even python3.5) manually like this.
background_runner.pyhits the osm's api server for fetching changesets of a particular user using their display name asynchronously.
Scheduling leaderboard updates
Instead of running the
background_runner.py manually, the program can be scheduled at regular intervals or specified time using utilities like crontab. Look at the
cron_sample for an example.
This project is license under GPL v3 copyleft license. Read
LICENSE file for more infomration.