2012-09-11 72 views
0

我有Django网站。我更改了应用程序的代码。但没有任何效果(重置Apache)。它可能是依赖高速缓存的模板:如何从django模板重置缓存?

TEMPLATE_LOADERS = (
    'dbtemplates.loader.Loader', 
    ('django.template.loaders.cached.Loader', (
      'django.template.loaders.filesystem.Loader', 
      'django.template.loaders.app_directories.Loader', 
    )), 

但我不知道如何刷新或删除,或重置cache.Thank的求助,

+0

什么让你觉得模板加载有什么关系缓存? –

+0

我的意思是memcache。 – titoalehandro

回答

0

这只是我的直觉,但我认为,这个缓存模板在数据库中。

删除dbtemplates,我认为你没有任何问题....但仅是直觉

PS:“dbtemplates.loader.Loader”是魔鬼

+0

你的意思是:TEMPLATE_LOADERS =( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader')? – titoalehandro

+0

难道你不明白TEMPLATE_LOADERS的意思吗? – Goin

+0

我明白了。我尝试了没有'dbtemplates.loader.Loader'的TEMPLATE_LOADERS,但是没有效果。 – titoalehandro

0
from django.template.loader import template_source_loaders 

def reset_template_cache(): 
    if not template_source_loaders: 
     return 

    for loader in template_source_loaders: 
     loader.reset() 

有你去:)