我正在使用 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 [2013 年 4 月 11 日 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:由于 andrews barret django-cms app hook at homepage error部分修复
我基本上在 /home 中添加了一个名为 /films 的子页面,确保它 不在 navigation中,并在那里添加了 app-hook。
这不起作用
urlpatterns = patterns('',
url(r'^new$', views.new, name='new'),
)
这项工作:
urlpatterns = patterns ('',
url(r'^.*$', 'request_quote.views.new', name='new'),
)