Django:在WSGI应用程序中找不到自定义模板标记

2024-04-25 12:00:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Django中第一次使用自定义templatetags。经过一些麻烦,我让它与runserver一起工作。但是现在当我试图通过Apache(使用mod wsgi)访问页面时,我得到了一个错误:

TemplateSyntaxError at /
'webpage_helpers' is not a valid tag library: Template library webpage_helpers not found,
tried django.templatetags.webpage_helpers,django.contrib.admin.templatetags.webpage_helpers,django.contrib.staticfiles.templatetags.webpage_helpers,webpage.templatetags.webpage_helpers

我的文件结构如下:

^{pr2}$

错误开始于webpage/index.html

{% extends 'base/base.html' %}
{% load webpage_helpers %}

My wsgi.py仍然是默认值,它只包含一条指向settings.py的行。在

错误显示它将正确的位置(webpage.templatetags.webpage_helpers)作为最后一项。在

我尝试通过以下方式重新启动apache: sudo service apache2 restart

请记住,它与runserver完美配合。在

有人知道我做错了什么吗?在


Tags: djangopywsgibaseapachehtml错误library