Currently django.contrib.sites documentation suggest to use initial data
fixtures to setup correct name and domain for the project
(https://docs.djangoproject.com/en/dev/ref/contrib/sites/):
`django.contrib.sites` registers a `post_migrate` signal handler which
creates a default site named `example.com` with the domain `example.com`.
This site will also be created after Django creates the test database. To
set the correct name and domain for your project, you can use an initial
data fixture.
However automatic loading of fixtures has been deprecated in Django 1.7:
https://docs.djangoproject.com/en/dev/howto/initial-data/#automatically-
loading-initial-data-fixtures
It would be nice if there was a description in the documentation how to
setup sites configuration with migrations. I tried achieving this but
without success - referring to `Site` model from `sites` in migration of
some app leads to: `LookupError: No installed app with label 'sites'`.
--
Ticket URL: <https://code.djangoproject.com/ticket/22482>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22482#comment:1>
Comment (by rtnpro):
I believe that "initial data fixture" does not map directly to
automatically loading of 'initial_data.<format>' fixtures. You can load
the fixtures with {{{ python manage.py loaddata <fixturename> }}} as well
as by a custom migration (which does not need any fixture AFAIK).
--
Ticket URL: <https://code.djangoproject.com/ticket/22482#comment:2>
Comment (by scibi):
IMHO it should be possible to initialize `sites` automatically while
deploying the project. So it would be great to have a way of doing this
described in the docs.
--
Ticket URL: <https://code.djangoproject.com/ticket/22482#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"bbf0a9545bd098f09aeb0c2fb63497eb0ddf13ad"]:
{{{
#!CommitTicketReference repository=""
revision="bbf0a9545bd098f09aeb0c2fb63497eb0ddf13ad"
Fixed #22482 -- Recommended using data migrations in contrib.sites docs.
Thanks scibi for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22482#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"8c7d2edd45cc1f1a9c5146e3be9716fbcfcbc826"]:
{{{
#!CommitTicketReference repository=""
revision="8c7d2edd45cc1f1a9c5146e3be9716fbcfcbc826"
[1.7.x] Fixed #22482 -- Recommended using data migrations in contrib.sites
docs.
Thanks scibi for the report.
Backport of bbf0a9545b from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22482#comment:5>