dud*_*man 15 python django django-templates osqa
这是我得到的错误:
ImproperlyConfigured: Error importing template source loader django.template.loaders.filesystem.load_template_source: "'module' object has no attribute 'load_template_source'"
Run Code Online (Sandbox Code Playgroud)
这是我的加载器模板代码:
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.load_template_source',
'django.template.loaders.app_directories.load_template_source',
'forum.modules.template_loader.module_templates_loader',
'forum.skins.load_template_source',
)),
]
Run Code Online (Sandbox Code Playgroud)
当我从互联网上下载项目时,所有这些代码都在那里.我正在尝试使用这些说明设置OSQA.我正在运行MS SQL Server并安装了Python 2.6.有关如何修复此错误的任何帮助(当我尝试运行runserver并找到设置我的东西的http链接时找到.错误会在命令行中弹出).我是Django和Python的新手,所以我真的不知道如何诊断正在发生的事情.manage.py
gir*_*uid 26
如果你查看关于模板加载器类型的文档(向下滚动到缓存的模板加载器部分),看起来当你配置缓存的加载器时,你仍然需要传递它Loader
- 所以你想要改变你的配置看起来像这个:
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',
)),
]
Run Code Online (Sandbox Code Playgroud)
我不确定forum
应用程序的加载器是什么,但你可能也想要Loader
那里的类(你需要阅读该应用程序上的文档来解决这个问题 - 并非所有第三方模板加载器都与缓存的加载器一起工作).
归档时间: |
|
查看次数: |
10230 次 |
最近记录: |