maazza
maazza

Reputation: 7183

django cms custom app page endless redirect

I am building a website using Django-cms and I code my own Django app (request_quote)

The error I have is that when I try to access an url defined in request_quote.urls.py , it gets stuck in an endless loop but a Django-cms created page works well

I did everything as in http://docs.django-cms.org/en/develop/extending_cms/extending_examples.html

The redirects:

[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

My 'request_quote.urls'

from django.conf.urls import patterns, url

from request_quote import views

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

The '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)

EDIT: Part of the error is that the url/view is not found (should be a 404) Found it by putting random stuff in the url (which generates the same endless loop)

EDIT2: partly fixed thanks to andrews barret 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.

This does not work

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

This Work:

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

Upvotes: 1

Views: 953

Answers (1)

maazza
maazza

Reputation: 7183

Ok fixed by using only 'en' in fallback languages in settings.py

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

and set LANGUAGE_CODE = 'en'

Upvotes: 3

Related Questions