django-blog-zinnia / cmsplugin-zinnia

Bridge between django-blog-zinnia and django-cms
BSD 3-Clause "New" or "Revised" License
53 stars 46 forks source link

NoReverseMatch Error When Accessing App Hook #44

Closed src-r-r closed 9 years ago

src-r-r commented 9 years ago

When I navigate to a page with a cmsplugin-zinnia app_hoook the following error is returned:

NoReverseMatch at /blog/

u'zinnia' is not a registered namespace

Request Method:     GET
Request URL:        http://127.0.0.1:8000/blog/
Django Version:     1.7.4
Exception Type:     NoReverseMatch
Exception Value:    u'zinnia' is not a registered namespace

In template <home>/django-blog-zinnia/zinnia/templates/zinnia/tags/
categories.html, error at line 5

...

{% load i18n %}
<ul class="{% if not categories %}no-{% endif %}categories">
{% for category in categories %}
    <li{% if category.slug == context_category.slug %} class="current"{% endif %}>
        <a href="{{ category.get_absolute_url }}"
        title="{% blocktrans %}Show all entries in {{ category }}{% endblocktrans %}">{{ category }}</a>
    {% blocktrans count entry_count=category.count_entries_published %}{{ entry_count }} entry{% plural %}{{ entry_count }} entries{% endblocktrans %}
    </li>
    {% empty %}
        <li>
            {% trans "No categories yet." %}
        </li>
{% endfor %}
</ul>

My system has the following setup:

I installed DjangoCMS with djangocms-installer, installed zinnia, set up django-blog-zinnia as per the README, and set up cmsplugin-zinnia as per the README, paying close attention to do the following:

  1. Keep the zinnia URL in my main urls.

    url(r'^weblog/', include('zinnia.urls', namespace='zinnia'))
  2. Add a cms page with the slug 'blog'
  3. Create a category and entry. Publish the category and entry.
  4. On the "blog" page, add the app hook "Published Categories"
  5. Published categories are listed.
  6. Once the app hook is added, remove the zinnia URL from my main urls
  7. Restart the server.
  8. Navigate to the '/blog/' page. The error occurs.

If I leave the zinnia url in my main urls the '/blog/' page does render, but when I navigate to one of the categories, django can't resolve the URL (as the documentation states).

Any ideas? Thanks.

src-r-r commented 9 years ago

Ah, I think I figured it out. I'll post the solution for those who were also confused.

On your blog page in the DjangoCMS Menu go to Page > Advanced Settings. For Application select Zinnia Blog. For Application Instance Name, make sure it says zinnia. Click Save.

bittner commented 7 years ago

Also note that you need to have the CMS page published in order to make this error go away. (I had this problem.)

A freshly created page with an Apphock configured will still display a NoReverseMatch Error when not published. This is mentioned - implicitly regarding this problem - in the django CMS docs.