Skip to main content

django-strava

PyPI version CI

A reusable Django app for the Strava V3 API under the 2026 Developer Program, backed by django-healthdatamodel: activities land as Workout rows (with metadata) and, optionally, heart-rate / cadence / power streams as Record series — nothing Strava-shaped is stored except the OAuth connection itself.

Strava API notes (June 2026 Developer Program)

  • Every new app lands in the Standard tier: 1 athlete by default, self-upgradeable to 10 in the API settings dashboard, no review needed. The developer account must hold an active Strava subscription.
  • Rate limits (default): 200 requests/15 min & 2,000/day overall; 100/15 min & 1,000/day for reads. Doubled after the 10-athlete upgrade. The client retries 429s and exposes the latest X-RateLimit-* headers.
  • The API host moves to a new domain in 2027 (available 2027-01-04, mandatory 2027-06-01). Set STRAVA_API_BASE_URL to cut over without a code change.
  • Auth uses Authorization: Bearer headers and the new POST /oauth/revoke endpoint exclusively — nothing here depends on the transports retired in 2027.

Quick start

  1. Install alongside the storage layer:

    pip install django-strava
    
  2. Add both apps to INSTALLED_APPS:

    INSTALLED_APPS = [
        ...,
        "healthdatamodel",
        "strava",
    ]
    
  3. Configure credentials from your Strava API application:

    STRAVA_CLIENT_ID = "..."
    STRAVA_CLIENT_SECRET = "..."
    STRAVA_REDIRECT_URI = "https://example.com/strava/callback/"
    # optional:
    STRAVA_CONNECT_SUCCESS_URL = "/"          # default: /admin/
    STRAVA_DEFAULT_SCOPES = ["read", "activity:read_all", "profile:read_all"]
    STRAVA_WEBHOOK_VERIFY_TOKEN = "..."       # only if using webhooks
    STRAVA_API_BASE_URL = "https://www.strava.com/api/v3"  # 2027 host cutover knob
    
  4. Route the app and migrate:

    path("strava/", include("strava.urls")),
    
    python manage.py migrate
    
  5. Send a logged-in user to /strava/connect/ to run the OAuth flow, then sync:

    python manage.py sync_strava --user alice --days 30
    python manage.py sync_strava --days 7 --streams --stream-limit 10
    

Webhooks

Route strava/webhook/ publicly, set STRAVA_WEBHOOK_VERIFY_TOKEN, then:

python manage.py create_strava_subscription https://example.com/strava/webhook/

Every event POST emits strava.signals.event_received; connect a receiver that calls (or enqueues) strava.webhooks.process_event, which re-fetches the activity through the authenticated API and ingests/deletes accordingly, and marks connections disconnected on athlete deauthorization events.

Demo project

A click-through demo lives in demo/ (login → connect → sync → browse):

uv sync --group dev
export STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=...
uv run python manage.py migrate
uv run python manage.py createsuperuser
uv run python manage.py runserver

Set your Strava application's Authorization Callback Domain to localhost, then open http://localhost:8000/.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_strava-0.2.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_strava-0.2.0-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file django_strava-0.2.0.tar.gz.

File metadata

  • Download URL: django_strava-0.2.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_strava-0.2.0.tar.gz
Algorithm Hash digest
SHA256 92dfe1fe3a1dd00a46d22a59d1b9e763ac1d285fad8c51b47e28ac9c3d5b64cf
MD5 9917417fcd0663c3fb7b1b541700b2bc
BLAKE2b-256 eeb7d3eec2beb3fa47f21232e4bd01c08ae029a692460a975a9a593d6a5709fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_strava-0.2.0.tar.gz:

Publisher: ci.yml on django-health/django-strava

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_strava-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_strava-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_strava-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fab80f10076beaaa521326e19da6e5a0b9c50d60a43c0b140386e309c9c3b61d
MD5 cf59e6a7c746ae172b5ab1180fdc1543
BLAKE2b-256 340ddf4f231d3a5d1a46e49173b8c13f718436b70da815e1a672ef51a41310bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_strava-0.2.0-py3-none-any.whl:

Publisher: ci.yml on django-health/django-strava

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page