Configuring django settings to work with 1.4.1. Loading template error

前端 未结 2 1054
春和景丽
春和景丽 2021-02-13 06:21

Here is the error I got:

ImproperlyConfigured: Error importing template source loader django.template.loaders.filesystem.load_template_source: \"\'module\' obje         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-13 06:33

    If you look at the documentation on template loader types (scroll down to the cached template loader section), it looks like when you configure the cached loader you still need to pass it Loader classes - so you'd want to change your config to look like this:

    if DEBUG:
        TEMPLATE_LOADERS = [
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',      
        ]
    else:
        TEMPLATE_LOADERS = [
            ('django.template.loaders.cached.Loader',(
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
                'forum.modules.template_loader.module_templates_loader',
                'forum.skins.load_template_source',
                )),
        ]
    

    I'm not sure what the loaders are for the forum app, but you probably also want Loader classes there as well (you'll need to read the documentation on that app to figure that out - not all third party template loaders work with the cached loader).

提交回复
热议问题