Hi Adam, > I'm presuming I will use the sites app. However, I don't see how I > can create and set the SITE_ID through the admin (which is necessary > for number 2). > > Would people suggest that I use the RequestSite class from the sites > app which uses the HttpRequest variables? If so, does anybody know of > any best practice examples in urls.py (I'm presuming).
I did something similar but I didn't use sites framework. I started using a Middleware that reads the host and define the site based on it. The middleware acts on all urls and I didn't want this, I want only some views to use this funcionallity, then I change from middleware to a decorator applyed on specific views. See an example: def site_publisher(f): """ Get the site based on the host accessing it. """ def newf(request, *args, **kw): domain = request.META['HTTP_HOST'] if domain.startswith('www.'): domain = domain[4:] request.site = get_object_or_404(Site, domain__name=domain) return f(request, *args, **kw) return newf Best regards, -- Michel Sabchuk http://turbosys.com.br/ --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---