質問

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?

役に立ちましたか?

解決

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.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top