Django和Django CMS错误 [英] Django and Django CMS Error

查看:120
本文介绍了Django和Django CMS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了Django和Django-CMS的全新安装(包括全新的virtualenv和python build)。我得到这个bizzarre错误..谷歌一直没有帮助。想法?

I've just done a fresh install of Django and Django-CMS from the ground up (including a brand new virtualenv and python build). I'm getting this bizzarre error.. google has been no help. Ideas?

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:


推荐答案

刚刚发生这个错误。在我的情况下,这是由urls.py模式中引用的三角引号(comment)引起的。

实际上它并没有被解释为一个注释,而是传递给函数!

Just had this error. In my case it was caused by having tripple quoted string (comment) in urls.py patterns.
Actually it was not interpreted as a comment and was passed to function!

这篇关于Django和Django CMS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆