Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15346 closed (worksforme)

SITE_ID default value is wrong

Reported by: depaolim 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: UI/UX:

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

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by carljm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 3 years ago by depaolim

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 Changed 3 years ago by carljm

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 Changed 3 years ago by carljm

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.