The foundation for building a SaaS product with Django
Project description
Django SaaS
A modular foundation for building multi-tenant SaaS products with Django.
Features
- Multi-Tenancy: Flexible tenant discovery (Header, Path, Session).
- Identity & Authentication: Robust user management with Password and SSO (Google, GitHub, Apple) support.
- Organization & RBAC: Tenant-level organization with Members, Groups, and a global Permission/Role registry.
- Custom Domains: Support for custom domain management and verification.
- API First: Enhanced DRF integration with tenant-aware filters and permissions.
- Developer Tools: Pre-configured SKILLs for AI-assisted development.
Install
pip install django-saas
Configuration
Add the required apps to your Django project's settings.py:
INSTALLED_APPS = [
# ...
'saas',
'saas.identity',
'saas.tenancy',
'saas.sessions',
'saas.tokens',
'saas.domain',
'saas.sso',
'saas.drf',
]
AUTHENTICATION_BACKENDS = [
'saas.identity.backends.ModelBackend',
'saas.sso.backends.UserIdentityBackend',
'django.contrib.auth.backends.ModelBackend',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# SaaS Middlewares
'saas.middleware.HeaderTenantIdMiddleware',
'saas.middleware.PathTenantIdMiddleware',
'saas.middleware.SessionTenantIdMiddleware',
'saas.middleware.TenantMiddleware',
'saas.sessions.middleware.SessionRecordMiddleware',
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
'saas.tokens.authentication.TokenAuthentication',
],
'DEFAULT_SCHEMA_CLASS': 'saas.drf.spectacular.AutoSchema',
}
URL Configuration
Include the SaaS URLs in your project's urls.py:
from django.urls import include, path
urlpatterns = [
path('api/', include('saas.api_urls')),
path('sso/', include('saas.sso.auth_urls')),
]
Documentation for AI Agents
This project includes specialized context for AI developers. If you are using an AI assistant, point it to AGENTS.md and the skills/ directory for automated workflows.
License
BSD-3-Clause
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_saas-0.2.0.tar.gz.
File metadata
- Download URL: django_saas-0.2.0.tar.gz
- Upload date:
- Size: 136.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8772208e410b858e0fd2e1c88d6734ba16b4989bf40b6c70cb58dcdc194292da
|
|
| MD5 |
6f89ead024d6d49f054215454bec54b5
|
|
| BLAKE2b-256 |
e9314a16e96ef14765af1e5ddfb0cd6d63229460dbcf698997b0de5b8d8d2d36
|
Provenance
The following attestation bundles were made for django_saas-0.2.0.tar.gz:
Publisher:
pypi.yml on django-saas/django-saas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_saas-0.2.0.tar.gz -
Subject digest:
8772208e410b858e0fd2e1c88d6734ba16b4989bf40b6c70cb58dcdc194292da - Sigstore transparency entry: 919326345
- Sigstore integration time:
-
Permalink:
django-saas/django-saas@d4eb6c92a8ec47e93d99338be8477d35fc53365d -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/django-saas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@d4eb6c92a8ec47e93d99338be8477d35fc53365d -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_saas-0.2.0-py3-none-any.whl.
File metadata
- Download URL: django_saas-0.2.0-py3-none-any.whl
- Upload date:
- Size: 170.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b8da9c52ae5db2c3de75f263f4cbfe0f68f20330e02bf39a5e23d00cd5bfc7
|
|
| MD5 |
65c3709671a7affa25199785804e78c8
|
|
| BLAKE2b-256 |
d85f126a8b74809c818c329eaa9958e1a2d2c4e722fae98b583538f554ed1637
|
Provenance
The following attestation bundles were made for django_saas-0.2.0-py3-none-any.whl:
Publisher:
pypi.yml on django-saas/django-saas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_saas-0.2.0-py3-none-any.whl -
Subject digest:
c6b8da9c52ae5db2c3de75f263f4cbfe0f68f20330e02bf39a5e23d00cd5bfc7 - Sigstore transparency entry: 919326351
- Sigstore integration time:
-
Permalink:
django-saas/django-saas@d4eb6c92a8ec47e93d99338be8477d35fc53365d -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/django-saas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@d4eb6c92a8ec47e93d99338be8477d35fc53365d -
Trigger Event:
push
-
Statement type: