1. Wilfred Hughes
  2. django-filetransfers
  3. Issues
Issue #1 open

Template error, module named api not found

Anonymous created an issue

I followed the instructions posted here: http://www.allbuttonspressed.com/projects/django-filetransfers#installation

And this is the error I'm getting when trying to access a template that has {% load filetransfers %}

TemplateSyntaxError: 'filetransfers' is not a valid tag library: Could not load template library from django.templatetags.filetransfers, No module named api

Comments (15)

  1. Roberto Rosario

    Yes, it is inside INSTALLED_APPS

    calling it using ./manage.py shell, "from filetransfers import api" works ok, it is just the api import inside the template tag that's returning the error.

    This is the import that's failing:


    Line 4: from ..api import public_download_url

  2. Roberto Rosario

    Yes, they are, just in case deleted them, .pyc and recreated the init.py using touch but still no luck.

    Only workaround so far has been removing the relative import and creating a symlink of api.py inside templatetags

  3. Waldemar Kornewald

    Try putting this at the top of templatetags/media.py:

    import logging
    logging.info('!!!!module name: %s" % __name__)

    Then, take a look at the logging output of the dev_appserver and check if the module name is actual filetransfers.templatetags.filetransfers.

    Also, from "manage.py shell" try to do "from filetransfers.templatetags.filetransfers import register". Does that work?

    If this still doesn't work, could you make a little sample project and upload it here, so I can check it locally?

  4. kenmacd

    I'm seeing this issue now as well. The module name I'm seeing is: 'django.templatetags.filetransfers'.

    It's on a turnkeylinux.org django image, which is running 1.1.1, with python 2.6.5.

    It works fine on Django 1.4 that I'm running locally.

    Any other suggestions?

  5. kenmacd
    • changed status to open

    It's worth noting that 1.1.1's version of defaulttags.py looks like this:

                lib = get_library("django.templatetags.%s" % taglib)
            except InvalidTemplateLibrary, e:
                raise TemplateSyntaxError("'%s' is not a valid tag library: %s" %
                                          (taglib, e))

    But it looks like Django's templatetags/init.py is supposed to take care of that:

    from django.conf import settings
    from django.utils import importlib
    for a in settings.INSTALLED_APPS:
            __path__.extend(importlib.import_module('.templatetags', a).__path__)
        except ImportError:

    The problem is that it just uses the apps .templatetags module, so ..api isn't included.

  6. Log in to comment