Django和Django CMS错误

时间:2011-07-11 04:07:20

标签: python django django-cms

我刚从头开始全新安装了Django和Django-CMS(包括一个全新的virtualenv和python版本)。我收到这个bizzarre错误..谷歌一直没有帮助。想法?

TemplateSyntaxError at /
Caught AttributeError while rendering: 'str' object has no attribute 'regex'

In template /Users/bdunlay/python/python-2.5/lib/python2.5/site-packages/django_cms2.1.0.beta3-py2.5.egg/cms/templates/cms/new.html, error at line 37

这是一行:

37: <li>Log into <a href="{% url admin:index %}">admin</a> and <a href="{% url pages-root %}admin/cms/page/add/">add</a> some pages.</li>

更多东西

/Users/bdunlay/python/python-2.5/lib/python2.5/site-packages/Django-1.3-py2.5.egg/django/core/urlresolvers.py in _populate
    return '<%s %s (%s:%s) %s>' % (self.__class__.__name__, self.urlconf_name, self.app_name, self.namespace, self.regex.pattern)
def _populate(self):
    lookups = MultiValueDict()
    namespaces = {}
    apps = {}
    for pattern in reversed(self.url_patterns):
-->     p_pattern = pattern.regex.pattern ...
        if p_pattern.startswith('^'):
            p_pattern = p_pattern[1:]
        if isinstance(pattern, RegexURLResolver):
            if pattern.namespace:
                namespaces[pattern.namespace] = (p_pattern, pattern)
                if pattern.app_name:

1 个答案:

答案 0 :(得分:16)

刚出现这个错误。在我的情况下,它是由urls.py模式中的tripple引用字符串(注释)引起的 实际上它并没有被解释为评论而是被传递给了函数!