Skip to main content

Django Middleware for mapping domains to custom url confs.

Project description

django-multi-domains

This Django App sets specific URL Confs for configured domains.

After all, the app has only a small middleware.

Installation

pip install django-multi-domains

Setup

The following configurations should be added in the Django Settings Module.

  1. Add "multi_domains" to INSTALLED_APPS

    INSTALLED_APPS = [
        "...",
        "multi_domains",
    ]
    
  2. Add middleware "multi_domains.middleware.MultiDomainsMiddleware" to the beginning of the MIDDLEWARE

    MIDDLEWARE = [
        "multi_domains.middleware.MultiDomainsMiddleware",
        "...",
    ]
    
  3. Define the mapping of domain and urlconf MULTI_DOMAINS

    MULTI_DOMAINS = {
        "api.example.com": "api.urls",
        "shop.example.com": "shop.urls",
    }
    

If no mapping is set for a domain, ROOT_URLCONF is used as a fallback.

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-multi-domains-0.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

django_multi_domains-0.0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file django-multi-domains-0.0.1.tar.gz.

File metadata

  • Download URL: django-multi-domains-0.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for django-multi-domains-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4d22fbced3211ddc0d26e2674b36bb6ada93078e00384152db8b67ea5db42047
MD5 dfc86406f7fc3e18d4c6692873d18998
BLAKE2b-256 4628ac48accf223b9b8c6d216477733559cc86b542a0dfbb0c56bc0df71c52fc

See more details on using hashes here.

File details

Details for the file django_multi_domains-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_multi_domains-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for django_multi_domains-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83e04e55e8439e2d24352b47f5628aace58d036335e2e941d2d698ef8b2a7a94
MD5 e1416ae2200dfe69db630ba482c81983
BLAKE2b-256 c42d2e05d833504e54468a210d22f7b950418cfd4b19f8614b2e96918ffee582

See more details on using hashes here.

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