You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
789 B
25 lines
789 B
"""
|
|
Domain-based URL Configuration Middleware
|
|
|
|
This middleware detects the request domain and routes to the appropriate
|
|
URLconf (URL configuration) for each site:
|
|
- Dovoodi domains → config.urls_dovoodi
|
|
- Imam Javad domains → config.urls_imamjavad
|
|
"""
|
|
|
|
|
|
class SiteMiddleware:
|
|
"""
|
|
Middleware to route requests to different URL configurations based on domain.
|
|
|
|
This allows each domain to have clean /admin/ URLs instead of path-based
|
|
differentiation (/imam-javad/admin vs /dovoodi/admin).
|
|
"""
|
|
|
|
def __init__(self, get_response):
|
|
self.get_response = get_response
|
|
|
|
def __call__(self, request):
|
|
# Force Dovoodi URL configuration for all domains
|
|
request.urlconf = 'config.urls_dovoodi'
|
|
return self.get_response(request)
|