Skip to main content

django-lti

A Django reusable app providing support for LTI Advantage.

Installation

Install using pip.

pip install django-lti

Setup

Start by adding lti_tool to your project's INSTALLED_APPS.

INSTALLED_APPS = [
    ...
    "lti_tool",
]

Then, add lti_tool.middleware.LtiLaunchMiddleware to the MIDDLEWARE setting. It's important to list the LtiLaunchMiddleware after SessionMiddleware.

MIDDLEWARE = [
    ...
    'django.contrib.sessions.middleware.SessionMiddleware',
    'lti_tool.middleware.LtiLaunchMiddleware',
]

Finally, run migrations to initialize the needed database tables.

python manage.py migrate lti_tool

Usage

Adding JWKS and OIDC initiation URLs

To allow LTI platforms to retrieve a JWKS and initiate a launch, add paths for lti_tool.views.jwks and lti_tool.views.OIDCLoginInitView to urls.py

...

from lti_tool.views import jwks, OIDCLoginInitView

urlpatterns = [
    path(".well-known/jwks.json", jwks, name="jwks"),
    path("init/<uuid:registration_uuid>/", OIDCLoginInitView.as_view(), name="init"),
]

Generating and rotating keys

Keys for the JWKS can be generated using the rotate_keys management command.

python manage.py rotate_keys

Registering an LTI platform

An LTI platform can be registered through the Django admin, or using a custom interface.

Handling an LTI launch

To handle the LTI launch, inherit from LtiLaunchBaseView and implement the handler methods for the types of LTI message types that the application supports.

class ApplicationLaunchView(LtiLaunchBaseView):

    def handle_resource_launch(self, request, lti_launch):
        ...  # Required. Typically redirects the users to the appropriate page.

    def handle_deep_linking_launch(self, request, lti_launch):
        ...  # Optional.

    def handle_submission_review_launch(self, request, lti_launch):
        ...  # Optional.

    def handle_data_privacy_launch(self, request, lti_launch):
        ...  # Optional.

Each handler method receives the request, as well as a LtiLaunch object.

When a session is initiated by an LTI launch, data about the launch is available from the request at request.lti_launch as an LtiLaunch object. During a non-LTI session request.lti_launch will refer to an AbsentLtiLaunch object.

It is possible to distinguish between LtiLaunch and AbsentLtiLaunch objects using the .is_present and .is_absent properties.

Download files

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

Source Distribution

django_lti-0.10.1.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

django_lti-0.10.1-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file django_lti-0.10.1.tar.gz.

File metadata

  • Download URL: django_lti-0.10.1.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for django_lti-0.10.1.tar.gz
Algorithm Hash digest
SHA256 69d1f5b18d10c52e149a60747aba4a5df7840214fcef1c692297c91921358f39
MD5 e2761ed37912a3f5f395fc7f033b19d1
BLAKE2b-256 1b7a2e7d5de85682624454ef9db45c07f80b2336a64d6c716bfda2894f945745

See more details on using hashes here.

File details

Details for the file django_lti-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: django_lti-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for django_lti-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2dc455acf754ab4a1f2214b396fe694418e8071007caed5b03f7ee284e7d9ea8
MD5 511fd794b53d7b66afb9c029d0d852ec
BLAKE2b-256 94db18c923fa2887dba5fad155d1645dde52476c9c99f446ba9e8ee0033db9bc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 files

0.10.0

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page