mirror of
https://github.com/django/django.git
synced 2024-12-25 10:35:48 +00:00
Fixed #15573: Forced the default site id to be 1 when creating test databases, to prevent a large number of errors when running the tests using the oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
13bb06984c
commit
d3c08fd813
@ -248,6 +248,14 @@ class BaseDatabaseCreation(object):
|
||||
interactive=False,
|
||||
database=self.connection.alias)
|
||||
|
||||
# One effect of calling syncdb followed by flush is that the id of the
|
||||
# default site may or may not be 1, depending on how the sequence was
|
||||
# reset. If the sites app is loaded, then we coerce it.
|
||||
from django.db.models import get_model
|
||||
Site = get_model('sites', 'Site')
|
||||
if Site is not None and Site.objects.using(self.connection.alias).count() == 1:
|
||||
Site.objects.using(self.connection.alias).update(id=settings.SITE_ID)
|
||||
|
||||
from django.core.cache import get_cache
|
||||
from django.core.cache.backends.db import BaseDatabaseCache
|
||||
for cache_alias in settings.CACHES:
|
||||
|
Loading…
Reference in New Issue
Block a user