gpt4 book ai didi

python - django cms自定义应用程序页面无限重定向

转载 作者:行者123 更新时间:2023-12-01 05:46:32 26 4
gpt4 key购买 nike

我正在使用 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'),
)

“请求报价”。 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 中放入随机内容找到它(这会生成相同的无限循环)

编辑2:感谢安德鲁斯·巴雷特,部分修复 django-cms app hook at homepage error

I basically add a child page to /home named /films, making sure it's not in navigation, and add the app-hook there as well.

这不起作用

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

这项工作:

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

最佳答案

通过在 settings.py 中的后备语言中仅使用“en”即可修复

CMS_LANGUAGES = {
'default': {
'fallbacks': ['en',],
'redirect_on_fallback':True,
'public': False,
'hide_untranslated': False,
}
}

并设置 LANGUAGE_CODE = 'en'

关于python - django cms自定义应用程序页面无限重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15943649/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com