= django-for-runners

Store your GPX tracks of your running (or other sports activity) in django.

It's currently experimental ... Pre-Alpha state...


| {{https://travis-ci.org/jedie/django-for-runners.svg|Build Status on travis-ci.org}} | [[https://travis-ci.org/jedie/django-for-runners/|travis-ci.org/jedie/django-for-runners]] |
| {{https://codecov.io/gh/jedie/django-for-runners/branch/master/graph/badge.svg|Coverage Status on codecov.io}} | [[https://codecov.io/gh/jedie/django-for-runners|codecov.io/gh/jedie/django-tools]] |
| {{https://coveralls.io/repos/jedie/django-for-runners/badge.svg|Coverage Status on coveralls.io}} | [[https://coveralls.io/r/jedie/django-for-runners|coveralls.io/r/jedie/django-for-runners]] |
| {{https://landscape.io/github/jedie/django-for-runners/master/landscape.svg|Status on landscape.io}} | [[https://landscape.io/github/jedie/django-for-runners/master|landscape.io/github/jedie/django-for-runners/master]] |


== Screenshots


== v0.1.1 2018-6-15 ==
{{https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/django-for-runners/for-runners%20v0.1.1%202018-6-15%20GPX%20Track.png|for-runners v0.1.1 2018-6-15 GPX Track.png}}


== v0.0.1 2018-5-30 ==
{{https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/django-for-runners/for-runners v0.0.1 2018-5-30 change list.png|for-runners v0.0.1 2018-5-30 change list.png}}

{{https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/django-for-runners/for-runners v0.0.1 2018-5-30 change GPX Track.png|for-runners v0.0.1 2018-5-30 change GPX Track.png}}


== try-out


e.g.:

{{{
# create a python virtualenv:
~$ python3 -Im venv DjangoForRunnersEnv

# activate the created virtualenv:
~$ cd DjangoForRunnersEnv/
~/DjangoForRunnersEnv$ source bin/activate

# Upgrate pip:
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv$ pip3 install --upgrade pip

# install django-for-runners:
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv$ pip3 install -e git+https://github.com/jedie/django-for-runners.git@master#egg=django_for_runners

# install dependencies:
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv$ cd src/django-for-runners/
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv/src/django-for-runners$ pip install -r requirements/tests.txt
}}}


start the development server, e.g.:

{{{
# activate the virtualenv:
~$ cd DjangoForRunnersEnv/
~/DjangoForRunnersEnv$ source bin/activate

# start server:
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv$ cd src/django-for-runners/
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv/src/django-for-runners$ ./run_test_project_dev_server.sh
}}}


import GPX files, e.g.:

{{{
# activate the virtualenv:
~$ cd DjangoForRunnersEnv/
~/DjangoForRunnersEnv$ source bin/activate

# import:
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv$ cd src/django-for-runners/
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv/src/django-for-runners$ ./manage.py import_gpx --username <username> ~/backups/gpx_files
}}}


== run tests

{{{
# activate the virtualenv:
~$ cd DjangoForRunnersEnv/
~/DjangoForRunnersEnv$ source bin/activate

# import:
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv$ cd src/django-for-runners/
(DjangoForRunnersEnv) ~/DjangoForRunnersEnv/src/django-for-runners$ ./setup.py test
}}}


**Note:**

To run all tests, you need:

* **Chromium Browser WebDriver** e.g.: {{{apt install chromium-chromedriver}}}
* **Firefox Browser WebDriver** aka **geckodriver**

install **geckodriver** e.g.:
{{{
~$ cd /tmp
/tmp$ wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz -O geckodriver.tar.gz
/tmp$ sudo sh -c 'tar -x geckodriver -zf geckodriver.tar.gz -O > /usr/bin/geckodriver'
/tmp$ sudo chmod +x /usr/bin/geckodriver
/tmp$ rm geckodriver.tar.gz
/tmp$ geckodriver --version
geckodriver 0.20.1
...
}}}


== some notes


=== GPX storage

Currently we store the unchanged GPX data in a TextField.


=== Precision of coordinates

GPX files from Garmin (can) contain:

* latitude with 29 decimal places
* longitude with 28 decimal places
* elevation with 19 decimal places

The route on OpenStreetMap does not look more detailed, with more than 5 decimal places.

See also: https://wiki.openstreetmap.org/wiki/Precision_of_coordinates


== Django compatibility

|= django-for-runners |= Django CMS |= django version |= python         |
| v0.x.x            | 3.4.x TLS   | 1.11 TLS        | 3.5, 3.6   |

(See also combinations in [[https://github.com/jedie/django-for-runners/blob/master/.travis.yml|.travis.yml]] and [[https://github.com/jedie/django-for-runners/blob/master/tox.ini|tox.ini]])

**Note:** Maps can't generated with Python 3.5 ([[https://github.com/wrobell/geotiler/issues/20|Geotiler needs Python 3.6 or later]])

== TODO:

 * Add real tests
 * Support Django CMS v3.5 and run tests against these versions.
 * Support Django v2.0 and run tests against these versions.


== history

* [[https://github.com/jedie/django-for-runners/compare/v0.1.1...master|compare v0.1.1...master]] **dev**
* [[https://github.com/jedie/django-for-runners/compare/v0.1.0...v0.1.1|15.06.2018 - v0.1.1]]:
** a few bugfixes
* [[https://github.com/jedie/django-for-runners/compare/v0.0.4...v0.1.0|15.06.2018 - v0.1.0]]:
** Render interactive OpenStreetMap track map with Leaflet JS
* [[https://github.com/jedie/django-for-runners/compare/v0.0.3...v0.0.4|12.06.2018 - v0.0.4]]:
** Better Events model
** GPX error handling
** more tests
** Bugfix for Python 3.5 (Geotiler needs Python 3.6 or later)
* [[https://github.com/jedie/django-for-runners/compare/v0.0.2...v0.0.3|12.06.2018 - v0.0.3]]:
** display min/average/max heart rate
** use autotask to generate the MAP in background
* [[https://github.com/jedie/django-for-runners/compare/v0.0.1...v0.0.2|31.05.2018 - v0.0.2]]:
** generate SVG 'icon' from GPX track
* v0.0.1 - 30.05.2018
** Just create a pre-alpha release to save the PyPi package name ;)


== links ==

| Homepage   | http://github.com/jedie/django-for-runners
| PyPi       | https://pypi.org/project/django-for-runners/


=== alternatives (OpenSource only) ==

* https://github.com/GoldenCheetah/GoldenCheetah/


== credits ==

The whole thing is based on many excellent projects. Especially the following:

* [[https://pypi.org/project/gpxpy/|gpxpy]] GPX file parser
* [[http://leafletjs.com|Leaflet JS]] A JS library for interactive maps used to render the track on [[https://openstreetmap.org/|OpenStreetMap]]
* [[https://pypi.org/project/geotiler/|geotiler]] Generate streetmap images
* [[https://pypi.org/project/geopy/|geopy]] Get geo location names of the GPX track start/end point
* [[https://pypi.org/project/matplotlib/|matplotlib]] plotting 2D graphics
* [[https://pypi.org/project/autotask/|autotask]] schedule background jobs
* [[https://pypi.org/project/svgwrite/|svgwrite]] Generating SVG file


== donation ==

* [[https://www.paypal.me/JensDiemer|paypal.me/JensDiemer]]
* [[https://flattr.com/submit/auto?uid=jedie&url=https%3A%2F%2Fgithub.com%2Fjedie%2Fdjango-for-runners%2F|Flattr This!]]
* Send [[http://www.bitcoin.org/|Bitcoins]] to [[https://blockexplorer.com/address/1823RZ5Md1Q2X5aSXRC5LRPcYdveCiVX6F|1823RZ5Md1Q2X5aSXRC5LRPcYdveCiVX6F]]
