﻿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
16488	Populating settings.CACHES based on settings.CACHE_BACKEND can fail	Jeremy Dunck	nobody	"I'm fairly sure this will be WONTFIX'd but I wanted to note this failure case in case it helps others.

If django.core.cache is imported before settings finish loading, it is possible that settings.CACHE_BACKEND will not yet be set, so that forward-compatibility patching proceeds incorrectly -- using locmem rather than whatever may have been declared later.

In my case, I ran into this with the fairly-common pattern of 2 settings files a.py and b.py, where b.py imports * from a.  A side-effect of importing a was that django.core.cache got imported.

The final config is defined with CACHE_BACKEND = ""dummy://"", but CACHES ended up with default engine of ""locmem://"".

Here's the code that patches CACHES from CACHE_BACKEND (if it's there):
https://code.djangoproject.com/browser/django/trunk/django/core/cache/__init__.py?rev=16549#L76

Perhaps a better option would be to make the patching lazier...
"	Bug	closed	Core (Cache system)	1.3	Normal	worksforme			Unreviewed	0	0	0	0	0	0
