问题描述
我在django应用中遇到以下错误:
I am getting the following errors in a django app:
TemplateSyntaxError at /
'markup' is not a valid tag library: Template library markup not found, tried django.templatetags.markup,django.contrib.admin.templatetags.markup
我尝试遵循此网站的解决方案表格, INSTALLED_APPS列表中缺少"django.contrib.markup",但我已经在其中了.
I have tried to following the solutions form this website which suggests that that 'django.contrib.markup' is missing from the INSTALLED_APPS list, but I already have it there.
我可以从python manage.py shell
中获取import markdown
,因此它已安装且位于路径中.
I can import markdown
from python manage.py shell
so it is installed and is in the path.
我正在使用Django 1.3.
I am using Django 1.3.
这是模板:
{% load markup %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...
我只是再次尝试了一次,它就可以了.奇怪的.在提交问题之前,我尝试重新启动服务器,但是现在不确定有什么不同.
I just tried it again, and it works. Odd. I tried restarting the server before submitting the question, but I am not sure what is different now.
推荐答案
尝试在相关模板上从python manage.py shell
调用render_to_response
,请提供相关模板文件的片段.
Try calling render_to_response
from python manage.py shell
on the template in question, and please give a clip of the template file in question.
固定吗?幽灵般的.我讨厌这些修补程序",因为无法保证它不会再次中断或相同的修补程序"将再次起作用.
Fixed itself? Spooky. I hate those "fixes" because there's no guarantee that it won't break again or that the same "fix" will work again.
我唯一能想到的是:
- 缓存了旧版本的东西
- 周围放着一个旧的.pyc文件
- 您的服务器试图变得聪明
- WSGI更改后未重新加载代码或模板
这篇关于Django标记templatetags错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!