Descope Django App
Descope is a user management and authentication platform. This plugin integrates Descope with your Django app.
Quick start
- Sign up for Descope and set admin roles
- Get your project id
- Create two roles in Descope, that will be mapped to Django permissions
- is_staff
- is_superuser
Map these roles to any user you would like to make a staff or superuser in your Django app. The names of these roles can be customized in the settings below.
- Install "django-descope" and add to your INSTALLED_APPS setting like this:
uv add django-descope
OR
pip install django-descope
INSTALLED_APPS = [
...
'django_descope',
]
- Add Descope Middleware after the AuthenticationMiddleware and SessionMiddleware
MIDDLEWARE = [
...
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
'django_descope.middleware.DescopeMiddleware',
]
- Include descope URLconf in your project urls.py like this:
path('auth/', include('django_descope.urls')),
- In your site templates, insert the
descope_flowtag where you want to place your flow
{% load descope %}
<!-- load the descope registry -->
{% if user.is_authenticated %}
<h1>Welcome {{ user.email }} you are logged in!</h1>
<p><a href="{% url 'logout' %}">Log Out</a></p>
{% else %} {% descope_flow "sign-up-or-in" "/" %}
<!-- provide the descope flow id, and where to redirect after a successful login-->
{% endif %}
- Start the development server and visit the newly created view
Testing
See test_admin.py for a rudimentary example of
how to utilize Descope Test Users
when testing your application with authenticated users.
You can use the helper django_descope.authentication.add_tokens_to_request to add the tokens to the django session
Local development
uv sync
uv run ruff check .
uv run python manage.py test
Set DESCOPE_PROJECT_ID and DESCOPE_MANAGEMENT_KEY before running tests that create Descope test users.
Settings
The following settings are available to configure in your project settings.py
Required
DESCOPE_PROJECT_ID
Optional
DESCOPE_MANAGEMENT_KEY
DESCOPE_IS_STAFF_ROLE
DESCOPE_IS_SUPERUSER_ROLE
Metadata
Release files for django_descope 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_descope-3.0.1.tar.gz | 9.5 kB | Without provenance | Details for django_descope-3.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_descope-3.0.1-py3-none-any.whl | Python 3 | none | any | Details for django_descope-3.0.1-py3-none-any.whl |
Total release size: 22.3 kB
Release files / django_descope-3.0.1.tar.gz
| Download URL | django_descope-3.0.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a79fa4448047db9203b79a3368e2728038b78ae369d635b643fe9fc2428e99fa
|
|
BLAKE2b-256 checksum How to use checksums |
3f2cef609a8e293e265ce73bcb00ef5e89ce7bc4b52c0438ac4f2c59b63ad8d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / django_descope-3.0.1-py3-none-any.whl
| Download URL | django_descope-3.0.1-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b085394b3217998562656a74f1c6558f1cbde6542cff7c1c8b69e517f7272779
|
|
BLAKE2b-256 checksum How to use checksums |
e1b648efe1fd5ad9bbcee3dc80399aac21ac206104871feff80b7ca44a963bdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for django_descope 3.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.