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 6
6
7
7
from bson import SON
8
8
from django .conf import settings
9
+ from django .core import management
9
10
from django .core .cache import DEFAULT_CACHE_ALIAS , CacheKeyWarning , cache , caches
10
11
from django .core .cache .backends .base import InvalidCacheBackendError
11
12
from django .http import (
17
18
)
18
19
from django .test import RequestFactory , TestCase , modify_settings , override_settings
19
20
20
- from django_mongodb_backend .cache import MongoDBCache
21
-
22
21
from .models import Poll , expensive_calculation
23
22
24
23
KEY_ERRORS_WITH_MEMCACHED_MSG = (
@@ -966,13 +965,7 @@ def drop_collection(self):
966
965
cache .collection .drop ()
967
966
968
967
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 )
976
969
977
970
978
971
@override_settings (USE_TZ = True )
You can’t perform that action at this time.
0 commit comments