I am creating custom template tags for my django site. I followed the django documentation for this and created the templatetags directory in my main application.
/project/apps/core/templatetags -/__init__.py -/core_extras.py
Since I'm not sure if this is causing the problem, I should note that I have this in my settings.py
sys.path.insert(0, join(PROJECT_ROOT, "apps")) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_evolution', 'apps.core', )
core_extras.py
from django import template import settings register = template.Library() class SiteNameNode(template.Node): def __init__(self): def render(self, context): site_name = getarrr(settings, "SITE_NAME", false) if not site_name: return "<!-- SITE_NAME not setting in Settings -->" if settings.DEBUG: return 'Debug || ' + site_name return site_name @register.tag(name="site_name") def find_site_name(parser, token): return SiteNameNode()
main.html
{% load core_extras %}
Error
In template /cygdrive/d/Users/Kin/BitNami DjangoStack projects/flipfinder/templates/main.html, error at line 1 'core_extras' is not a valid tag library: Template library core_extras not found, tried django.templatetags.core_extras,django.contrib.admin.templatetags.core_extras
Does anyone else encounter such a problem? I missed something obvious. I went through and double-checked everything, but I cannot find anyone with a similar problem.
source share