File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 66
77from bson import SON
88from django .conf import settings
9+ from django .core import management
910from django .core .cache import DEFAULT_CACHE_ALIAS , CacheKeyWarning , cache , caches
1011from django .core .cache .backends .base import InvalidCacheBackendError
1112from django .http import (
1718)
1819from django .test import RequestFactory , TestCase , modify_settings , override_settings
1920
20- from django_mongodb_backend .cache import MongoDBCache
21-
2221from .models import Poll , expensive_calculation
2322
2423KEY_ERRORS_WITH_MEMCACHED_MSG = (
@@ -966,13 +965,7 @@ def drop_collection(self):
966965 cache .collection .drop ()
967966
968967 def create_cache_collection (self ):
969- for cache_alias in settings .CACHES :
970- cache = caches [cache_alias ]
971- connection = cache ._db
972- if cache ._collection_name in connection .introspection .table_names ():
973- return
974- cache = MongoDBCache (cache ._collection_name , {})
975- cache .create_indexes ()
968+ management .call_command ("createcachecollection" , verbosity = 0 )
976969
977970
978971@override_settings (USE_TZ = True )
You can’t perform that action at this time.
0 commit comments