Opened 12 months ago

Closed 10 months ago

Last modified 10 months ago

#22482 closed Bug (fixed)

Sites documentation suggest using initial data fixtures which are deprecated in 1.7

Reported by: scibi Owned by: nobody
Component: Documentation Version: 1.7-beta-1
Severity: Normal Keywords: sites, migrations
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

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'.

Change History (5)

comment:1 Changed 12 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 12 months ago 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).

comment:3 Changed 12 months ago 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.

comment:4 Changed 10 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In bbf0a9545bd098f09aeb0c2fb63497eb0ddf13ad:

Fixed #22482 -- Recommended using data migrations in contrib.sites docs.

Thanks scibi for the report.

comment:5 Changed 10 months ago by Tim Graham <timograham@…>

In 8c7d2edd45cc1f1a9c5146e3be9716fbcfcbc826:

[1.7.x] Fixed #22482 -- Recommended using data migrations in contrib.sites docs.

Thanks scibi for the report.

Backport of bbf0a9545b from master

Note: See TracTickets for help on using tickets.
Back to Top