Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django-cms Apphook url doesn't load

I have a django-cms project that contains an app called core. Inside core I created a file "cms_app.py" as follows:

# -*- coding: utf8 -*-
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _

class CoreApphook(CMSApp):
    name = _(u"Core Apphook")
    urls = ["core.urls"]

apphook_pool.register(CoreApphook)

In my core/urls.py I have the following code:

# -*- coding: utf8 -*-
from django.conf.urls.defaults import patterns, include, url

urlpatterns = patterns('',

        # URLS refrentes ao apphook CoreApphook
        url(r'^$', 'noticia.views.ultimas_noticias'),
        url(r'^noticias/$', 'noticia.views.ultimas_noticias'),
        url(r'^noticias/(?P<categoria>[\w\d-]+)/$', 'noticia.views.noticias_categoria'),
        url(r'^noticias/(?P<categoria>[\w\d-]+)/(?P<pagina>\d+)/$', 'noticia.views.noticias_categoria_paginated'),
        url(r'^noticias/(?P<categoria>[\w\d-]+)/(?P<subcategoria>[\w\d-]+)/(?P<titulo>[\w\d-]+)/$', 'noticia.views.noticia'),
        url(r'^paginacao/noticias/$', 'noticia.views.noticias_categoria_paginated'),
    )

I'm trying to reach this view:

url(r'^noticias/(?P<categoria>[\w\d-]+)/(?P<subcategoria>[\w\d-]+)/(?P<titulo>[\w\d-]+)/$', 'noticia.views.noticia'),

By using this url:

http://127.0.0.1:8000/noticias/filmes/acao/lol-e-poka-zuera/

But the file urls.py is not loaded by the Apphook. I've already set the Apphook field in every child page of "Noticias" and "Noticias" as well. The weird thing about it is that I have the same structure in another project which works perfectly. And obviously I've set the app "core" into INSTALLED_APPS. I just can't even imagine what may be causing this issue. I've used a breakpoint into my core/urls.py, but It's not being called by the Apphook.

like image 716
Mauricio Avatar asked Nov 03 '22 22:11

Mauricio


1 Answers

urlpatterns = patterns('',

    # URLS refrentes ao apphook CoreApphook
    url(r'^$', 'noticia.views.ultimas_noticias', name='app_ultimas_noticias'),
    url(r'^noticias/$', 'noticia.views.ultimas_noticias', name='app_ultimas_noticias1'),
)
like image 106
Rogério Carrasqueira Avatar answered Nov 15 '22 04:11

Rogério Carrasqueira