好吧,当我尝试在 Django 中使用“包含”时,我遇到了一些我自己无法解决的困惑问题。
我的项目有结构。
MyProject---
App1---
__init__.py
models.py
test.py
urls.py
views.py
App2---
...
template---
App1---
some htmls
App2---
...
templatetags---
__init__.py
inclusion_cld_tags.py
manage.py
urls.py
__init__.py
settings.py
我在 settings.py 中注册了 templatetags 文件夹(都在 Installed APPS 和 TEMPLATE_DIRS 中)。但是当我想在我的 html 中使用 {% load contains_test %} 时,它会引发如下异常:
'inclusion_cld_tags' is not a valid tag library: Could not load template library from django.templatetags.inclusion_cld_tags, No module named inclusion_cld_tags
我认为我的导入工作没有问题,我该怎么办?
感谢帮助!
我的 django 版本:1.0+ 我的 Python 版本:2.6.4