Metadata-Version: 2.4
Name: drmx-django
Version: 1.3.0rc10
Summary: Server-authorized DRM-X playback for Django
License-Expression: MIT
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django<6.1,>=5.2
Dynamic: license-file

# Django: use your existing application

Install `packages/python/drmx_django-1.3.0rc10-py3-none-any.whl` with pip.
Requires Python 3.12+ and Django >=5.2,<6.1. See https://docs.drm-x.com/en/integrations/source-downloads#release for tested versions.
The SDK has no catalog, purchase, enrollment or access-grant models and creates no database tables.

Keep your authentication, sessions, CSRF middleware and database. Add `drmx` to INSTALLED_APPS,
include `path('video/', include('drmx.urls'))`, and configure:

```python
DRMX = {
    'SITE_ID': os.environ['DRMX_SITE_ID'],
    'SITE_KEY': os.environ['DRMX_SITE_KEY'],
    'ACCESS_KEY': os.environ['DRMX_ACCESS_KEY'],
    'INSTANCE_ID': 'my-website',
    'AUTHORIZE': 'myapp.drmx_access.authorize',
    'POLICY': 'multi-tier-standard',
}
```

In YOUR application, implement the callback (a callable also works):

```python
def authorize(user, video_id):
    # Use your existing application to obtain the Content ID AND verify access.
    # Return None for unknown, unpaid, expired, disabled or revoked access.
    # Once authorized, return:
    # return {'content_id': your_content_id, 'title': 'Your title',
    #         'content_type': 'vod', 'policy': 'multi-tier-standard'}
    return None
```

Visit `/video/<your-website-video-id>/` while signed in. IDs may be strings or UUIDs.
The callback runs separately on each page and session request; never cache authorization
inside the SDK. It returns a mapping or None; missing configuration denies access.
`content_type` defaults to `vod`; a missing `policy` uses the configured default, while
an explicitly empty policy inherits the DRM-X environment policy. Only the server selects policy.
The browser's Content ID/type must match the freshly authorized result.

No DRM-X migration command is needed for a new install. Your own authentication/database
migrations remain your responsibility. The `examples/sdk/django/authorization.py` file is
the application customization point; do not edit installed site-packages.

CSRF/origin checks, bounded JSON, HTTPS/no redirects and response Content ID binding remain.
The existing player passes a masked CSRF token in the session URL; exclude query strings
from access logs on that route. Keep credentials out of pages, logs and source.

Upgrading preview.8 with existing DRM-X tables: read `legacy/README.md` in the kit first.
The new SDK uses the `drmx_playback` app label. It never deletes legacy tables or migration
records. Preserve any old app/migration dependencies before upgrading.

## Optional mobile and TV apps

Set `DRMX['APP_AUTHENTICATE']` to your viewer token validator; the `<video_id>/app-session/` route reuses the existing AUTHORIZE callback.

[App integration tutorial](MOBILE-AND-TV-APPS.md). App routes are streaming-only; connect your existing identity provider before use.
