Subdomains with Middleware or Subdomains with Apache Virtual Hosts?

I'm new to Django...

I need to start a project that will have subdomains, but I'm little confused about this subject...

I will have a website serving Spain, other serving United Kingdom and other serving United States and I will use only one domain and 3 subdomains, just like this:

Main domain:

mysite.com

Subdomains:

es.mysite.com
uk.mysite.com
us.mysite.com

These 3 different site in future could have to scale, each one in one dedicated server, but for now these 3 websites will use the same server.

In a previous question I was told to use a middleware solution(http://thingsilearned.com/2009/01/05/using-subdomains-in-django/) but I don't konw if it this that I need. With this solution if I need to scale the websites for dedicated servers each one I think will not work...

It is possible to define instead the subdomains in Apache Virtual Hosts? What do you think of using 3 different Django projects with Apache Virtual Hosts will doing the job? This is a better solution or I should go with middleware?

Best Regards,


If you're looking to expand the subdomains to different servers eventually, the easier solution will probably be using virtual hosts on your web server.

Each host can just use a separate settings module (they can all import * from a common settings module, changing any database / language settings which are specific to that domain).

Deploying this way means you have a higher memory usage, since you will be dealing with separate instances for each domain, but that doesn't sound like it will be a problem for you and your long term direction. It also makes things simpler, using middleware can get messy (especially with tests and the like).

链接地址: http://www.djcxy.com/p/33728.html

上一篇: Django测试客户端和子域

下一篇: 带有Apache虚拟主机的中间件或子域的子域?