Code Koala

Django's New Comment System

Django's newly merged comments application seemed to break a lot of things for me. Here are some tips in case you're in the same boat.

There are a lot of exciting changes happening with Django right now. A lot. Some of these changes cause a lot of things to break across my sites. One such change was the integration of Thejaswi Puthraya's Summer of Code project: an improved comment system.

The first, and most obvious problem, was the change in the URLconf. This took me a while to track down for one reason or another. Here's the situation: originally, the django.contrib.comments application used a URLconf such as:

(r'^comments/', include('django.contrib.comments.urls.comments')),

This makes any comments-powered pages blow up. To solve this particular problem, just make it:

(r'^comments/', include('django.contrib.comments.urls')),

The next thing that caught me dealt with the templates for comments. Now there are actually some default ones, which is nice, but they might interfere with your own templates. I found that all I need in my templates/comments/ directory now is a single simple template called base.html:

{% extends 'base.html' %}

All of the other templates aren't needed unless you do some customized stuff (which I don't bother with).

Finally, and probably the most frustrating of all, getting an error such as:

NoReverseMatch: Reverse for '<function post_comment at 0xb504a1b4>' not found.

I'm not really sure why this problem has arisen, but my solution for it is to remove the entire django/contrib/comments/ directory and bring it back down from SVN. My guess is that some .pyc file lingering from the original comments application is interfering with the new comments application.

Feel free to post here if you have any other advice or problems!

Previous Article: Andy Rutledge: Don't Walk; Run

Comments

  1. I forgot to mention this... There is a pretty simple upgrade guide for moving your comments from the original @comments@ application to the new one: "comments upgrade guide":http://docs.djangoproject.com/en/dev/ref/contrib/comments/upgrade/

    Posted by: wheaties , 27 aug 2008, 10:19 a.m.
  2. Thanks for the info. I'm in the process of upgrading to Django's new comments also. The URL change got me also until I found this article. Thanks! Nice site. Your django-tracking project looks pretty cool also.

    Posted by: sofeng , 30 aug 2008, 12:46 a.m.
  3. Hi sofeng! I'm glad that you found the article to be of use! Please feel free to try out the django-tracking application and let me know what you think. If you have any problems with it, please get in touch so we can work them out :)

    Posted by: wheaties , 31 aug 2008, 9:34 p.m.
  4. Very good post

    Posted by: Luis , 9 sep 2008, 7:14 a.m.

Post a Comment

This article is closed for comments.

Copyright © 2008 Josh VanderLinden. All rights reserved.
Home : My Ramblings : Projects : About Code Koala : Terms of Use
Design inspired by Free CSS Templates

A Django site.
Powered by Django 1.1 pre-alpha SVN-9506 and Python 2.5.1
1 of 4 active users is reading this page