Search code examples
pythondjangodjango-sitesdjango-1.6

How to set site domain without Django sites framework in place?


I'm moving my site from Django 1.5.x to Django 1.6.0, and I noted this in the release notes:

[..] The admin is now enabled by default in new projects; the sites framework no longer is. [..]

How to set the default domain (instead of www.example.com) without the Django sites framework?

Are any sites related settings now made redundant redundant by this change?


Solution

  • Two options:

    • Define the domain name as a constant in your settings and use it where needed in your code. If you have only one site this is a reasonable decision as you no longer need the whole sites framework.
    • Enable the sites framework again and define one Site object with www.example.com as domain. You'll also need to specify the site's id as SITE_ID in your Django settings.