django cms自定义应用页面无限重定向

时间:2013-04-11 08:07:33

标签: python django django-cms

我正在使用Django-cms构建一个网站,我编写自己的Django应用程序(request_quote)

我遇到的错误是,当我尝试访问request_quote.urls.py中定义的url时,它会陷入无限循环但是Django-cms创建的页面运行良好

我在http://docs.django-cms.org/en/develop/extending_cms/extending_examples.html

中做了所有事情

重定向:

[11/Apr/2013 09:55:32] "GET / HTTP/1.1" 302 0
[11/Apr/2013 09:55:36] "GET /en-us/ HTTP/1.1" 200 279593
[11/Apr/2013 09:55:42] "GET /request_quote/new/ HTTP/1.1" 302 0
[11/Apr/2013 09:55:44] "GET /en-us/request_quote/new/ HTTP/1.1" 302 0
[11/Apr/2013 09:55:45] "GET /en-us/en-us/request_quote/new/ HTTP/1.1" 302 0
[11/Apr/2013 09:55:46] "GET /en-us/en-us/en-us/request_quote/new/ HTTP/1.1" 302 0
[11/Apr/2013 09:55:47] "GET /en-us/en-us/en-us/en-us/request_quote/new/ HTTP/1.1" 302 0
[11/Apr/2013 09:55:48] "GET /en-us/en-us/en-us/en-us/en-us/request_quote/new/ HTTP/1.1" 302 0
[11/Apr/2013 09:55:49] "GET /en-us/en-us/en-us/en-us/en-us/en-us/request_quote/new/ HTTP/1.1" 302
     

0       [11 / Apr / 2013 09:55:50]“GET / en-us / en-us / en-us / en-us / en-us / en-us / en-us / request_quote / new /   HTTP / 1.1“302 0

我的'request_quote.urls'

from django.conf.urls import patterns, url

from request_quote import views

urlpatterns = patterns('',
                       url(r'^new$', views.new, name='new'),
)

'request_quote。 cms_app'

from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _

class RequestQuote(CMSApp):
    name = _("RequestQuote")
    urls = ["request_quote.urls"]

apphook_pool.register(RequestQuote)

编辑: 部分错误是找不到url / view(应该是404) 通过在URL中添加随机内容(生成相同的无限循环)来找到它

EDIT2: 由于安德鲁斯巴雷特,部分固定 django-cms app hook at homepage error

  

我基本上将一个子页面添加到/ home named / films,确保它是   不在导航中,并在那里添加app-hook。

这不起作用

    urlpatterns = patterns('',
                           url(r'^new$', views.new, name='new'),
    )

这项工作:

urlpatterns = patterns ('',
                       url(r'^.*$', 'request_quote.views.new', name='new'),
)

1 个答案:

答案 0 :(得分:2)

通过在settings.py

中使用后备语言中的'en'来解决问题
CMS_LANGUAGES = {
    'default': {
        'fallbacks': ['en',],
        'redirect_on_fallback':True,
        'public': False,
        'hide_untranslated': False,
    }
}

并设置LANGUAGE_CODE ='en'