Wiadomość napisana w dniu 2008-10-27, o godz. 04:00, przez killer barney:
> I'm not too familiar with how to handle subdomain requests on django. > If i have test.example.com, is this somethign I'm supposed to find in > the urls.py?? Or is this done in the middleware? > > I'm really confused about this, so you may have to give me step by > step instructions =) It depends. If the subdomain is supposed to handle part of your application functionality (eg. section for partners, admin application, some other management interface), it seems feasible to do the routing in middleware by changing request.urlconf, like: class SubdomainsMiddleware(object): def process_request(self, request): parts = request.META['HTTP_HOST'].split('.') if parts[0] in settings.SUBDOMAINS_MAP: request.urlconf = settings.SUBDOMAINS_MAP[parts[0]] The above example code requires that you maintain a mapping (dictionary) of subdomain names to urlconf modules. In any other case I'd suggest configuring virtual host and serve it with another application. -- We read Knuth so you don't have to. - Tim Peters Jarek Zgoda, R&D, Redefine [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---