Question

I have Django 1.5.1 installed and django-cms 2.4.2

However I have not integrated zinnia blog and django-cms just yet.

I was able to create a blog entry but when going to the blog entry

8000/en/weblog/2013/10/13/test-entry/

I receive a 404 Page not Found

any thoughts?

No correct solution

OTHER TIPS

Possible cause: order of urlpatterns inclusions in urls.py. Django-Cms design lack.

Fix: put cms.urls after zinnia.urls:

 # patterns or i18n_patterns here.
 urlpatterns = i18n_patterns('',                                                                                                                                           
     url(r'^admin/', include(admin.site.urls)),                                                                                                                            
     url(r'^blog/', include('zinnia.urls')),                                                                                                                               
     url(r'^comments/', include('django.contrib.comments.urls')),                                                                                                          
     url(r'^', include('cms.urls')),
 )

Explanation:

If you include cms urls before zinnia urls, django-cms "slug" pattern matches a wide range of URLs including Zinnia blog entry URL:

<RegexURLPattern pages-details-by-slug ^(?P<slug>[0-9A-Za-z-_.//]+)/$>

As an example, it will match: "blog/2014/01/20/test-article-about-something/"

After it matched as django-cms:pages-details-by-slug, the whole URI is stored in the "slug" variable and is provided as an argument (in "kwargs") to cms.views.detail view function. And this view will call:

cms.utils.page_resolver import get_page_from_request(request, use_path=slug)

and cms will not find (and will raise "Resolver404" exception) any suitable page to render because this URI belongs to Zinnia blog.

End of story.

Resources:

  1. "details" view can be found here: cms.views
  2. django url resolving logic is here: django.core.urlresolvers mainly in two "resolve" methods. (lines: 315 *recursive, 209 *non-recursive)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top