python Custom template tags and filters is not a valid tag library

http://stackoverflow.com/questions/8607544/django-could-not-load-template-tag/21588173#21588173

suppose you have the following structure:

– Application_Name

——-templatetags

————–init.py

————–templates_extras.py

——-init.py

——-settings.py

– manage.py
You have to make sure of the following:

  1. your application itself inside which your “templatetags” is resident is actually installed in INSTALLED_APPS in settings.py (e.g. “Application_Name”)

  2. your tag module itself that exists inside “templatetags” is already installed in INSTALLED_APP in settings.py (e.g. “ApplicationName.templatetags.tempaltes_extras”)

  3. keep sure you have “init.py” under templatetags directory

  4. you have to restart the server

  5. In some cases you have to remove all generated *.pyc if it did not work then retry again

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章