It took me a while to figure out how to change from the default, example.com. Maybe it should have been obvious, but I was looking in all the wrong places and every search I did wouldn’t come up with an answer. As I discovered, it isn’t a setting in the settings.py file. It’s something that is in the database. You can change it through the Django admin interface, phpMyAdmin, or however you feel comfortable. It’s in the django_site table. When setting SITE_ID in settings.py it is the ID in this table. And this is the information that Site.objects.get_current().domain uses. Which is awesome for rss feeds and e-mails that you send out or anytime you need the domain in a link.

from django.contrib.sites.models import Site
domain = Site.objects.get_current().domain

I use webfaction to host a lot of my django projects. It has an easy setup that will get you developing quickly and a great community of talented programmers. There is also a quick setup for rails, wordpress, and a lot more.

Related posts:

  1. Django Single Sign On or a Solution to Multi-domain Cookies  I’ve been working on a project for a while and it has recently started to expand to an additional domain...
  2. How to Speed up Your Django Sites with NginX, Memcached, and django-compress  A lot of these steps will speed up any kind of application, not just django projects, but there are a...
  3. How to Add Locations to Python Path for Reusable Django Apps  In my previous post I talk about reusable apps, but I don’t really explain it that much. If you have...