

Using subdomains (e.g. http://XYZ.someserver.com) with django - nocivus
http://sharjeel.2scomplement.com/2008/07/24/django-subdomains/

======
jhancock
WARNING: don't use subdomains if you want users in China to be able to get to
your site. By default, most/all subdomains managed like this do not get put in
China's DNS properly. Get used to life with the great firewall, it is what it
is ;)

~~~
jonknee
I still manage to get spam from China on a site with subdomains. It would
actually be a feature if I could easily block all of China.

~~~
tannerhiland
You can always do a country lookup from APNIC that will give you all of the
IP's assigned to China (or any other country that regional registrar manages).

<http://www.apnic.net/apnic-bin/ipv4-by-country.pl?country=CN>

I wrote a script a while back that parses that list and creates an access-list
for country blocking. Maybe I'll put it online one day.

At least that's how us network folk do it.

------
niels
Why should django deal with subdomains. Just use mod_rewrite or whatever your
server offers to map your internal urls. myname.mydomain.com ->
mydomain.com/myname/

~~~
jonknee
It's much cleaner to have it taken care of in Django than through mod_rewrite.
For one all of your URL routing will still work. In your setup using {% url %}
or reverse() wouldn't work.

~~~
whalesalad
Yeah I agree here. Putting that inside of your application and outside your
web server config makes more sense to me. Especially using the reverse url
matching, which is so amazingly wonderful ( _especially_ when you give your
url's unique names like user-account-settings and can simply do {% url user-
account-settings %} and be done with it). Hat tip to obeattie.com for all my
django template ramblings above ;)

