0

I'm trying to set up a Django application that will accept multiple subdomain URLs. I'd like to test this locally. Since I can't nail this first step of passing in a url that has a subdomain, I can't get to the second part (figuring out if the URLconf I've set up for django-subdomains is working). The middleware checks for a subdomain, and chooses a URLconf file based on that subdomain.

I've set the following configs in /etc/hosts. When I've got the server running, and I hit these URLs, I go to the real test.com.

127.0.0.1 payments.test.com  
127.0.0.1 rampup.test.com  

(in case it matters) django-subdomains middleware settings from settings.py:

SUBDOMAIN_URLCONFS = {                                                          
    'payments': 'main.urls',                                                    
    'rampup': 'rampup.urls'                                                     
    }      

MIDDLEWARE_CLASSES = (                                                          
    'subdomains.middleware.SubdomainURLRoutingMiddleware',                      
    'django.middleware.common.CommonMiddleware',                                
    'django.contrib.sessions.middleware.SessionMiddleware',                     
    'django.middleware.csrf.CsrfViewMiddleware',                                
    'django.contrib.auth.middleware.AuthenticationMiddleware',                  
    'django.contrib.messages.middleware.MessageMiddleware',                     
    # Uncomment the next line for simple clickjacking protection:               
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',                 
)    
4

1 回答 1

0

尝试这个:

0.0.0.0 payments.test.com 
0.0.0.0 rampup.test.com
于 2013-03-26T00:02:47.777 回答