Store your GPX tracks of your running (or other sports activity) in django.
Project description
Store your GPX tracks of your running (or other sports activity) in django.
(The name Django-ForRunners has the origin from the great Android tracking app ForRunners by Benoît Hervier: http://rvier.fr/#forrunners )
Features:
GPX track management:
Upload GPX tracks
Import GPX tracks from commandline
Track analysis:
basics: Track length / Duration / Pace / Hart rate Up-/Downhill
Display route on OpenStreetMap map
Graphs with elevation / heart rate / cadence (if available in GPX data)
Data that is automatically extracted from the web:
Start/finish Address from OpenStreetMap
Start/finish weather information from metaweather.com
Store additional data:
Ideal track distance (for easier grouping/filtering tracks)
sports competitions Management:
Create a List of Sport Events
Add participation to a event
link GPX track with a event participation
Store you event participation:
official track length
measured finisher time
Number of participants who have finished in your discipline
Add links to webpages relatet to this event
Record costs (entry fee, T-shirt etc.)
common
Multiple user support (However: no rights management and currently only suitable for a handful of users)
Project structure
There are two main directories:
directory |
description |
---|---|
`/src/`_ |
The main Django-ForRunners source code |
`/deployment/`_ |
deploy Django-ForRunners for production use case |
install
There exists two kind of installation/usage:
local development installation using poetry
production use with docker-compose
This README contains only the information about local development installation.
Read /deployment/README for instruction to install Django-ForRunners on a root server.
prepare
~$ git clone https://github.com/jedie/django-for-runners.git ~$ cd django-for-runners/ ~/django-for-runners$ make _________________________________________________________________ DjangoForRunners - *dev* Makefile install-poetry install or update poetry install install DjangoForRunners via poetry manage-update Collectstatic + makemigration + migrate update update the sources and installation lint Run code formatters and linter fix-code-style Fix code formatting tox-listenvs List all tox test environments tox Run pytest via tox with all environments tox-py36 Run pytest via tox with *python v3.6* tox-py37 Run pytest via tox with *python v3.7* tox-py38 Run pytest via tox with *python v3.8* pytest Run pytest update-rst-readme update README.rst from README.creole publish Release new version to PyPi run-dev-server Run the django dev server in endless loop. createsuperuser Create super user messages Make and compile locales message files dbbackup Backup database dbrestore Restore a database backup run-docker-dev-server Start docker containers with current dev source code
local development installation
# install or update Poetry: ~/django-for-runners$ make install-poetry # install Django-ForRunners via poetry: ~/django-for-runners$ make install ... # Collectstatic + makemigration + migrate: ~/django-for-runners$ make manage-update # Create a django super user: ~/django-for-runners$ ./manage.sh createsuperuser # start local dev. web server: ~/django-for-runners$ make run-dev-server
The web page is available in Port 8000, e.g.: http://127.0.0.1:8000/
local docker dev run
You can run the deployment docker containers with current source code with:
~/django-for-runners$ make run-docker-dev-server
Just hit Cntl-C to stop the containers
The web page is available on Port 80, e.g.: http://localhost/
import GPX files
e.g.:
~/django-for-runners$ poetry run manage import_gpx --username <django_username> ~/backups/gpx_files
Note: It is no problem to start import_gpx with the same GPX files: Duplicate entries are avoided. The start/finish (time/latitude/longitude) are compared.
backup
Create a backup into .../backups/<timestamp>/ e.g.:
~/django-for-runners$ poetry run for_runners backup
The backup does:
backup the database
export all GPX tracks
generate .csv files:
a complete file with all running tracks
one file for every user
regenerate all SVG files
~/django-for-runners$ poetry run for_runners recreate-svg
Screenshots
(All screenshots are here: github.com/jedie/jedie.github.io/tree/master/screenshots/django-for-runners)
for-runers v0.6.0 2018-07-31 GPX Track.png
for-runners v0.4.0 2018-6-26 GPX info.png
for-runners v0.6.0 2018-07-19 Event Costs.png
print a small overview
run tests
~/Django-ForRunners$ make test or: ~/Django-ForRunners$ make tox
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.
static files
We collect some JavaScript files, for easier startup. These files are:
Project Homepage |
License |
storage directory |
---|---|---|
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 version |
python |
---|---|---|
>=v0.11.0 |
2.2.x LTS |
3.6, 3.7, 3.8 |
>=v0.7.1 |
2.1 |
3.5, 3.6, 3.7 |
v0.5.x |
2.0 |
3.5, 3.6, 3.7 |
(See also combinations in .travis.yml and tox.ini)
Backwards-incompatible changes
Older changes, see:
v0.12.0
Move main project sources into “/src/” Add deployment setup into “/development/”
history
-
tbc
-
refactor project structure and add a deployment via docker-compose setup
Add django-axes and django-processinfo
-
refactor gpx import code
update tests
Use poetry and add Makefile
update code style
-
Enhance “Event Participation” admin view: Add start date and costs in table
-
NEW: GPX Admin action to print a small overview from one or a few tracks
Accept optional server bind address, e.g.: for_runners run-server 127.0.0.1:8080
-
NEW: Update complete environment installation with: for_runners update
Move the SQlite database to virtualenv root dir, e.g.: ~/Django-ForRunners/Django-ForRunners-database.sqlite3
NEW: save every gpx track to disk
NEW: Backup/export via cli: $ for_runners backup
NEW: export GPX Data via django-import-export
Create xdg-open desktop starter under linux here: ~/Django-ForRunners/Django-ForRunners
refactor the startup process:
auto loop the server process
open web browser on first start
enable autotask
rename for_runners_test_project to for_runners_project
-
Fix “try-out” section in README, again ;(
-
NEW: shell script for easier boot/install, see above
-
Update to Django 2.1
Bugfix Tests
-
Use dygraphs in GPX Track change admin view
Sync mouse over from Elevation/Headrate/Cadence dygraphs to leaflet open streep map
Fix “try-out” section in README (Thanks adsworth for reporting)
Add links from gpx tracks to other admin change view
Bugfixes
internals:
refactor stuff around track duration/length
move manipluation of list_display and list_filter contributed by adsworth
-
NEW: event participation
NEW: costs of event participation (e.g.: entry fee for the competition, cost of a T-Shirt etc.)
NEW: Display statistics of events/costs per user and total
-
remove Django-CMS
update to Django v2.0
NOTE: The migrations are simply replaced! So you must delete your database, e.g.: src/django-for-runners$ rm test_project_db.sqlite3
Add ‘net duration’ field, for the officially measured time and use it for calculations if available.
Create django manage command to fill some base data: $ ./manage.py fill_basedata
speedup by deactivating some django debug toolbar panels
-
combine track filters with statistic views
NEW: GPX info (See length, point count and Average distance in meters between the points)
NEW: Display GPX metadata
Add ‘creator’ to every track and use it as changelist filter
remove Streetmap image generated via geotiler
Speedup by using a cache for gpxpy instances
-
Start adding statistics (See screenshot above)
add weather information from metaweather.com to every track
-
Display elevations, heart_rates and cadence_values if available
Add kilometer markers to OpenStreetMap
-
a few bugfixes
-
Render interactive OpenStreetMap track map with Leaflet JS
-
Better Events model
GPX error handling
more tests
Bugfix for Python 3.5 (Geotiler needs Python 3.6 or later)
-
display min/average/max heart rate
use autotask to generate the MAP in background
-
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 |
|
PyPi |
activity exporter
It’s sometimes hard to find a working project for exporting activities. So here tools that i use currently:
Garmin-Connect-Export from rsjrny
alternatives (OpenSource only)
https://github.com/pytrainer/pytrainer (Desktop Program)
https://github.com/GoldenCheetah/GoldenCheetah/ (Desktop Program)
Online tools:
credits
The whole thing is based on many excellent projects. Especially the following:
gpxpy GPX file parser
Leaflet JS A JS library for interactive maps used to render the track on OpenStreetMap
dygraphs open source JavaScript charting library
Chart.js HTML5 Charts
geopy Get geo location names of the GPX track start/end point
matplotlib plotting 2D graphics
autotask schedule background jobs
svgwrite Generating SVG file
donation
Note: this file is generated from README.creole 2020-11-14 14:37:02 with "python-creole"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-for-runners-0.12.0rc2.tar.gz
.
File metadata
- Download URL: django-for-runners-0.12.0rc2.tar.gz
- Upload date:
- Size: 882.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 258104f479616baa9a19a084c6434912b576f5f3fd80eb10a44e524e52abe97a |
|
MD5 | 990934b56f63886833a62163f532d1bd |
|
BLAKE2b-256 | 7187d1c8d47e099b73775df2c9a789b69888c349b5353b76b91b802ca9ab9ceb |
File details
Details for the file django_for_runners-0.12.0rc2-py3-none-any.whl
.
File metadata
- Download URL: django_for_runners-0.12.0rc2-py3-none-any.whl
- Upload date:
- Size: 942.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c37be705248ae66c6e3625482eec21763739fd486a9be77d761e6887f7b1a7 |
|
MD5 | 3ae1f5cc7cd2e897930657efe4c3095c |
|
BLAKE2b-256 | b1c72325cb9787ec56527c09b124ac249c0cb8f808b36b58df3a87cd906eed8e |