Skip to main content

Missing Django integration for Inngest

Project description

Django Inngest

Missing Django integration for Inngest. This package depends on the Inngest Python SDK (pypi)

Installation

uv add inngest django-inngest

Configuration

Update urls.py to include:

from django.contrib import admin
from django.urls import path, include
from django_inngest.urls import inngest_urls

urlpatterns = [
    # ...
    path("admin", admin.site.urls),
    # ...
]

# uses DJANGO_INNGEST_SERVE_PATH from settings.py
urlpatterns += inngest_urls

Update settings.py to include:

# required for inngest and production
INNGEST_EVENT_KEY = os.environ.get("INNGEST_EVENT_KEY", None)
INNGEST_SIGNING_KEY = os.environ.get("INNGEST_SIGNING_KEY", None)

# configuration
DJANGO_INNGEST_APP_ID = os.environ.get("DJANGO_INNGEST_APP_ID", "my-django-project")
DJANGO_INNGEST_IS_PRODUCTION = not DEBUG
DJANGO_INNGEST_CLIENT_LOGGER = os.environ.get(
    "DJANGO_INNGEST_CLIENT_LOGGER", "gunicorn"
)
DJANGO_INNGEST_INACTIVE_FUNCTION_IDS = os.environ.get(
    "DJANGO_INNGEST_INACTIVE_FUNCTION_IDS", []
)
DJANGO_INNGEST_AUTO_DISCOVER_FUNCTIONS = os.environ.get(
    "DJANGO_INNGEST_AUTO_DISCOVER_FUNCTIONS", True
)
# no trailing slash or leading slash
DJANGO_INNGEST_SERVE_PATH = os.environ.get("DJANGO_INNGEST_SERVE_PATH", "api/inngest")

Usage

Create a new Django app and workflows file:

python manage.py startapp myapp
touch myapp/workflows.py

Update INSTALLED_APPS to include myapp.

In myapp/workflows.py, create a new Inngest function:

from datetime import timedelta

import inngest
from django_inngest.client import inngest_client


@inngest_client.create_function(
    id="myapp/my-function",
    trigger=inngest.TriggerEvent(name="my/trigger/event"),
    rate_limit=inngest.RateLimit(
        limit=1,
        period=timedelta(minutes=2, seconds=30),
        key="event.data.channel_id",
    ),
)
def my_function(ctx: inngest.Context):
    print(ctx.event.data.get("channel_id"))
    # your inngest function logic here
    return "OK"

Then trigger anywhere in your Django project with:

import inngest
from django_inngest.client import inngest_client

event = inngest.Event(
    name="my/trigger/event",
    data={"channel_id": "1234567890"},
)

inngest_client.send(event)

Project details


Download files

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

Source Distribution

django_inngest-0.0.5.tar.gz (6.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_inngest-0.0.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file django_inngest-0.0.5.tar.gz.

File metadata

  • Download URL: django_inngest-0.0.5.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_inngest-0.0.5.tar.gz
Algorithm Hash digest
SHA256 164a9f1d0ba1a80199080bafb91edbf7778fbf396de478d23e5e95985c0ff3fb
MD5 a224a7329ae2028e797139c878e709dd
BLAKE2b-256 a09d540a6d4d199217fcb056ef324048be37e176c5f7556b653d6a58a561008c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_inngest-0.0.5.tar.gz:

Publisher: main.yaml on jmitchel3/django-inngest

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_inngest-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: django_inngest-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_inngest-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 82729692c52bfed7ecc9a0076228c9ec3380353771dcf55f7bfa51753aa60e2c
MD5 7e94b24b0380bfbdb1185e52da550a3a
BLAKE2b-256 b697ad64e66e5521cb3c3946c80f28ccd705c2d22009b321f62fe9939c3eaf99

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_inngest-0.0.5-py3-none-any.whl:

Publisher: main.yaml on jmitchel3/django-inngest

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

Supported by

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