﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31802	Add system check for SITE_ID.	Gagan Deep	Parth Verma	"The ""sites"" framework requires to set a `SITE_ID` to specify the database ID of the Site object associated with that particular settings file. From the documentation, it can be interpreted that it should be an integer. But, it can also be set to a string literal('1'). I know this is wrong, but the Django accepted it and worked with it anyway without showing any warning or error.

The problem arose with `SITE_CACHE`. It was not getting invalidated when the Site object is updated. The reason is the code which handles invalidation  uses primary key of instance object which will be an integer. Therefore, the cache is never invalidated.

{{{
try:
    del SITE_CACHE[instance.pk]
except KeyError:
    pass
}}}

[https://github.com/django/django/blob/3d16496037fbb8a6bbc6b6e354fa4f5eb65e6cea/django/contrib/sites/models.py#L103-L117 Please see complete code on GitHub.]

Since working of an element of Django is dependent on this setting, I suggest that there be a validation test for `SITE_ID`. "	Cleanup/optimization	closed	contrib.sites	dev	Normal	fixed	sites, cache	me@…	Ready for checkin	1	0	0	0	1	0
