Django multi-tenant app where each subdomain is a tenant
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
============ django-subdomain-tenancy
django-subdomain-tenancy is a Django multi-tenant app where each subdomain is a tenant, simplifying deployment, scalability, and per-client management.
Detailed documentation is in the "docs" directory.
Quick start
-
Add "django_subdomain_tenancy_omladalan.apps.SubdomainConfig" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ..., "django_subdomain_tenancy_omladalan.apps.SubdomainConfig", ]
-
Add this configs in "settings.py"::
AUTH_USER_MODEL = 'subdomain.CustomUser' LOGIN_URL = '/accounts/login/' LOGIN_REDIRECT_URL = "/" LOGOUT_REDIRECT_URL = "/"
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = XXXXXXXXX EMAIL_PORT = XXXXXXXXX EMAIL_USE_TLS = XXXXXXXXX EMAIL_HOST_USER = XXXXXXXXX EMAIL_HOST_PASSWORD = XXXXXXXXX DEFAULT_FROM_EMAIL = XXXXXXXXX
-
Include the polls URLconf in your project urls.py like this::
path("polls/", include("django_subdomain_tenancy.urls")),
-
Run
python3 manage.py migrateto create the models. -
Create a record in instance table for master dubdomain::
insert into django_subdomain_tenancy_intance values(1, "Master Tenant", "master", 1); -
Create SuperUser
administrator(It needs to be this way, because they're the only user who can log in to all the subdomains.), and set id instance1:python3 manage.py createsuperuser -
Visit the
/For Login in the system fronend,/admin/Logging is only allowed using the master subdomain. -
For the development environment, add one more instance; I'll use the test subdomain cobaia::
insert into django_subdomain_tenancy_intance values(2, "Cobaia Tenant", "cobaia", 1);If use Linux or Mac add the following lines to the
/etc/hostsfile:127.0.0.1 master.localhost 127.0.0.1 cobaia.localhostIf you're using Windows, you're starting the project the wrong way.
-
Access tenant urls:
master.localhost:8000 cobaia.localhost:8000Simple Login Frontend:
/accounts/login/
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_subdomain_tenancy_omladalan-0.1.0.tar.gz.
File metadata
- Download URL: django_subdomain_tenancy_omladalan-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9324a137792fe9adb280d93f28b5587960aa7edf69bba1989d981353d721f31
|
|
| MD5 |
a2248a16d19eb3d6d20c87d31f919bfd
|
|
| BLAKE2b-256 |
33ef074259adf211d23c4b850175f9a4986ff6192e706517a0a5c4c90a20e060
|
File details
Details for the file django_subdomain_tenancy_omladalan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_subdomain_tenancy_omladalan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2301784c71c348afd5f14a1ce64d00562c710a92c8f7bc0019053a2d953f0b1
|
|
| MD5 |
f52cd3dc32bed4801059c029cddac43e
|
|
| BLAKE2b-256 |
9ba7f2329f17563601ff9083513882675e3853b205e8a366903c02b42c5f3f06
|