Hi, I'm using Django 1.2.1 and I'm having problems trying to load my
template tags:

{% load mytags %}

TemplateSyntaxError at /myapp/

'mytags' is not a valid tag library: Template library mytags not
found, tried django.templatetags.mytags

It's defined in myproject/myapp/templatetags/mytags.py.

n...@nate-desktop:~/work/django-projects/myproject$ ls myapp/templatetags/
mytags.py  __init.py__
n...@nate-desktop:~/work/django-projects/myproject$ more
myapp/templatetags/mytags.py
from django import template

register = template.Library()

@register.simple_tag
def myclass(request):
    return request.path

I added 'myapp' to INSTALLED_APPS, and updated TEMPLATE_LOADERS (as
per a suggestion from StackOverflow):
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    'django.template.loaders.eggs.Loader',
    'django.template.loaders.app_directories.load_template_source',
)

When I start the server I see this warning message:

/usr/local/lib/python2.6/dist-packages/django/template/loaders/eggs.py:4:
UserWarning: Module _mysql was already imported from
/usr/lib/pymodules/python2.6/_mysql.so, but
/usr/lib/pymodules/python2.6 is being added to sys.path

When I try to import my module in the shell I also am unable to import it:

>>> from django.templatetags import mytags
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: cannot import name mytags
>>> from myapp.templatetags import mytags
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named templatetags

Does this mean something is wrong with my path or setup?  Any ideas?

Thanks,
Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to