我有一个具有下一个文件夹结构的 django 项目:
+ project
+ - - app_1
+ - - - - __init__.py
+ - - - - models.py
+ - - - - forms.py
+ - - - - urls.py
+ - - - - templates
+ - - - - - - index.html
+ - - - - - - edit.html
+ - - - - - - show.html
+ - - - - views
+ - - - - - - __init__.py
+ - - - - - - index.py
+ - - - - - - edit.py
+ - - - - - - show.py
+ - - - - - - templatetags
+ - - - - - - - - __init__.py
+ - - - - - - - - custom_tags.py
例如,当我尝试在 edit.html 模板中调用 custom_tags
{% load custom_tags %}
我得到下一个错误:
/app_1/ 处的 TemplateSyntaxError
“custom_tags”不是有效的标签库:找不到模板库 custom_tags
我的问题是:我需要在哪里放置 templatetags 文件夹或我需要做什么?
谢谢。