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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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