tnq / grogosite

http://technique.mit.edu/
2 stars 1 forks source link

Figure out why we can't use a database cache with localwiki #4

Closed quentinmit closed 12 years ago

philipn commented 12 years ago

I think this may be because of the browser cache headers that are automatically set when cache middleware is enabled. We ran into this at one point and I made a replacement bit of middleware. It's here: https://gist.github.com/1569228

Looking at your repos, it doesn't look like you have caching on? Or is that set in production by not here? If so, can you paste the settings / localsettings files?

( I was going to commit this to the localwiki repos and enable the caching middleware by default, but set things to use the dummy cache. )

quentinmit commented 12 years ago

We have caching turned on; see https://github.com/nwiltsie/Technique-Admin-Site/blob/master/settings.py#L94 for the file cache that we have turned on now or https://github.com/nwiltsie/Technique-Admin-Site/blob/fb04567420cdca2e53ad109c5828c18d490da057/settings.py#L77 for the database cache we had configured before merging localwiki.

I didn't actually see the error myself, but I think Nick said it appeared to be a conflict between GeoDjango and the DatabaseCache backend.

philipn commented 12 years ago

Can you post the error or behavior?

On Jan 6, 2012, at 5:46 AM, quentinmitreply@reply.github.com wrote:

We have caching turned on; see https://github.com/nwiltsie/Technique-Admin-Site/blob/master/settings.py#L94 for the file cache that we have turned on now or https://github.com/nwiltsie/Technique-Admin-Site/blob/fb04567420cdca2e53ad109c5828c18d490da057/settings.py#L77 for the database cache we had configured before merging localwiki.

I didn't actually see the error myself, but I think Nick said it appeared to be a conflict between GeoDjango and the DatabaseCache backend.


Reply to this email directly or view it on GitHub: https://github.com/nwiltsie/Technique-Admin-Site/issues/4#issuecomment-3384648

nwiltsie commented 12 years ago

If we add the following to settings.py:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
        'LOCATION': 'cache_table',
    }
}

... then we get the error (full dump on PasteBin):

django.core.exceptions.ImproperlyConfigured: 'django.contrib.gis.db.backends.spatialite' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of:
    'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: cannot import name BaseDatabaseCache
nwiltsie commented 12 years ago

Huh. Putting the same CACHES value above into our production server, where we use the django.contrib.gis.db.backends.mysql backend works just fine.

So... there's no problem? django.contrib.gis.db.backends.spatialite doesn't play nice, but that makes no difference for our actual site.