2012-09-11 74 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() 

有你去:)