Opened 14 years ago

Closed 14 years ago

Last modified 10 years ago

#15346 closed (worksforme)

SITE_ID default value is wrong

Reported by: Marco De Paoli Owned by: nobody
Component: Contrib apps Version: 1.2
Severity: Keywords: SITE_ID
Cc: depaolim@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

after upgrade to django 1.2.5

How to reproduce the problem:

django-admin.py startproject testdjango
cd testdjango
python manage.py startapp testapp
# edit settings for db connection parameters: use ORACLE
python manage.py test

Output:

DoesNotExist: Site matching query does not exist. 

(If you obtain:

AttributeError: 'module' object has no attribute 'handler500'

you can follow #15343)

Workaround: edit settings.py and set

SITE_ID = 2

Change History (5)

comment:1 by Carl Meyer, 14 years ago

Resolution: worksforme
Status: newclosed

Either you've created a second Site object and deleted the first, or you're reusing a database where one Site object has already been created and then removed (the most likely possibility), or Oracle begins all autonumbered ID sequences at 2 instead of 1 (which seems quite unlikely).

In any case the default SITE_ID won't be changed, because in almost all cases the value of 1 is correct. If it isn't correct for your particular case, then change it in your project.

comment:2 by Marco De Paoli, 14 years ago

I agree with you that the most likely possibility is that Site object has already been created and then removed by the testcase itself (maybe example.com?). I don't suggest to change the default value to 2 (anyway, why 2?!?). I just wanted to signal that after you start a default project, the project doesn't work on Oracle. To make it work you have to manually edit the settings.py and change the SITE_ID value. This is weird and I suspect that changing a parameter which is not cited in any tutorial and doesn't relate in any way with user, could be anti intuitive for a newbye...

comment:3 by Carl Meyer, 13 years ago

In [16868]:

Fixed #16353 -- don't try to create Site objects on all databases. Refs #15573, #15346. Thanks Aymeric Augustin for the report and the patch.

comment:11 by Carl Meyer, 13 years ago

In [16869]:

[1.3.X] Fixed #16353 -- don't try to create Site objects on all databases. Refs #15573, #15346. Thanks Aymeric Augustin for the report and the patch.

Backport of r16868 in trunk.

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

In 1f98ec2e53e4636863396ab54f671f4546f9ba4c:

Fixed #23929 -- Added more tests for create_default_site.

Refs: #15346, #15573, #16353, #16828.

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