Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23945 closed New feature (fixed)

Use configured SITE_ID when creating the default site

Reported by: Wojtek Ruszczewski Owned by: nobody
Component: contrib.sites Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Consider the following steps:

  • start a new project;
  • edit settings adding SITE_ID = 26 and 'django.contrib.sites';
  • migrate.

The default "example.com" site will be created with the primary key equal to 1 not 26.

Fixing it in general doesn't seem to cause any harm, but it probably only matters with some nonrel backends. For instance, in MongoDB automatic primary keys are certain bytestings 1 and mongo backend doesn't support anything else as keys.

[1] Supporting such keys requires some black magic, but that's another story.

Change History (3)

comment:1 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In bfc75996f9b7486929f0c4340bca54a8afa7ecfb:

Fixed #23945 -- Made default site use the configured SITE_ID.

comment:2 by Tim Graham <timograham@…>, 10 years ago

In 818182b:

Fixed #24488 -- Made create_default_site() use default pk of 1.

Fixed create_default_site() to use a default value in case
settings.SITE_ID isn't set; refs #23945.

comment:3 by Tim Graham <timograham@…>, 10 years ago

In febcbbf:

[1.8.x] Fixed #24488 -- Made create_default_site() use default pk of 1.

Fixed create_default_site() to use a default value in case
settings.SITE_ID isn't set; refs #23945.

Backport of 818182b514d1c6b379130c440689355b4d231d49 from master

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