Hi Tom. On Mar 24, 2:42 pm, Tom Smith <[EMAIL PROTECTED]> wrote: > A while ago Doug and Eivind asked about using subdomains for each app. > > I'd like to do this, but in the example they had a stab at they were > using Apache whereas I'm using Lighttpd...
One thing you might like to consider is having Lighty map the subdomain in to the url where it can be matched against your urlpatterns. In the Lighty config you can use a regex to match the host. If the regex has captures, these are available to be passed to FastCGI using %1, %2, etc (captures in the rewrite rule are $1, $2, etc). So in the Lighty config you can use something like: $HTTP["host"] =~ "([\w\d-]+)?\.?example\.com" { ... snip ... url.rewrite-once = ( ... snip ... "^(/.*)$" => "/extraset.fcgi/%1$1", ) } Now if you go to blog.example.com, the URL Django gets is /blog. If you go to blog.example.com/2006/, Django gets /blog/2006/. This makes it easy to match the subdomain in urlpatterns: urlpatterns = patterns('', (r'^blog/$', include('project.blog.urls'), ... etc The blog app doesn't know anything about the prefix in the url and doesn't need to know it is running on a subdomain. The user never sees the /blog prefix because this happens within the webserver. I've had this working, so let me know if you need any more details. Scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---