开发者

Django Error: TemplateSyntaxError:

Trying to get massivecoupon running and am running into a bunch of errors.

The most recent is:

File "/home/usr/.local/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module import(name)

TemplateSyntaxError: Caught ImportError while rendering: No module named libsmassivecoupon.countries Content-Type: text/html

The problem is that t开发者_开发技巧he module should be: massivecoupon.countries (which exists) and not libsmassivecoupon.countries (which does not)

The block of code in importlib.py that I believe is giving the error looks like this:

if name.startswith('.'):
    if not package:
        raise TypeError("relative imports require the 'package' argument")
    level = 0
    for character in name:
        if character != '.':
            break
        level += 1
    name = _resolve_name(name[level:], package, level)
__import__(name)
return sys.modules[name]

Any help with this would be appreciated. Thanks!


The main problem here (I had the same) is that stack trace does not match the real place where stuff happens. One of the last frames of exception (removing the template one) is on an urls.py 's direct_to_template line, while the problem was a few line after, where i did include('.some.relative.module').

I just switched to absolute include() here to solve it.


I can't really tell what that snippet does since it doesn't say what name is, or what package is. How about just ditching that and putting in a normal import statement for the modules you want?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜