[점프 투 장고 p140]

pybo/templatetags/pybo_filter.py 에
from django import template

register = template.Library()

@register.filter
def sub(value, arg):
return value - arg
라고 작성한 다음

question_list.html 수정
{% extends 'base.html' %}
{% load pybo_filter %}
...
해 보고 있습니다.

다음과 같은 에러가 발생합니다. 뭘 잘 못 했는지 모르겠습니다.
Error during template rendering
In template C:\projects\mysite\templates\pybo\question_list.html, error at line 2

'pybo_filter' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz

bnagain 2056

2021년 2월 19일 9:22 오후

알려주신 내용으로 봐서는 오류가 발생할만한 것이 없는데요.. 다음 URL 참조하셔서 작성하신것과 어떤 차이가 있는지 확인해 보세요. https://github.com/pahkey/djangobook/tree/3-03 - 박응용님, 2021년 2월 19일 10:43 오후 추천 , 대댓글
목록으로
1개의 답변이 있습니다. 1 / 1 Page

stackoverflow에서 검색해보니 장고를 다시 시작해야 한다고 답변이 나와있습니다.
저도 동일한 문제가 발생해서 다시 시작해 보니 문제가 해결되었습니다.
python manage.py runserver를 한뒤 다시 새로고침해보세요.
저는 말끔히 해결 됐습니다.
아래를 참고해 보심이..
https://stackoverflow.com/questions/44265564/django-registration-of-tag-library-not-working

According to django documentation:

Development server won’t automatically restart after adding the templatetags module, you will need to restart your server before you can use the tags or filters in templates.

최원호

2021년 3월 5일 9:53 오전

감사합니다 선생님... 저도 왜안되는지 찾아해맸었는데... - sudong님, 2023년 1월 27일 3:52 오후 추천 , 대댓글