what's wrong with my django comments?

18 views
Skip to first unread message

nonight

unread,
Sep 3, 2008, 11:14:29 AM9/3/08
to Django users
I have add (r'^comments/', include('django.contrib.comments.urls')) in
the urls.py

the codes in the template:
{% load comments %}
{% render_comment_form for user %}

the error was :
Caught an exception while rendering: No module named urls

Original Traceback (most recent call last):
File "/usr/local/lib/python2.4/site-packages/django/template/
debug.py", line 71, in render_node
result = node.render(context)
File "/usr/local/lib/python2.4/site-packages/django/template/
__init__.py", line 888, in render
return func(*resolved_vars)
File "/usr/local/lib/python2.4/site-packages/django/contrib/comments/
templatetags/comments.py", line 246, in comment_form_target
return comments.get_form_target()
File "/usr/local/lib/python2.4/site-packages/django/contrib/comments/
__init__.py", line 50, in get_form_target
return
urlresolvers.reverse("django.contrib.comments.views.comments.post_comment")
File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 251, in reverse
return iri_to_uri(u'%s%s' % (prefix,
get_resolver(urlconf).reverse(viewname,
File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 226, in reverse
possibilities, pattern = self.reverse_dict.get(lookup_view, [(),
()])
File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 160, in _get_reverse_dict
for name, (matches, pat) in pattern.reverse_dict.iteritems():
File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 153, in _get_reverse_dict
if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 197, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
ImportError: No module named urls
Template error

In template /usr/local/lib/python2.4/site-packages/django/contrib/
comments/templates/comments/form.html, error at line 2
Caught an exception while rendering: No module named urls
1 {% load comments %}
2 <form action="{% comment_form_target %}" method="POST">
3 {% for field in form %}
4 {% if field.is_hidden %}
5 {{ field }}
6 {% else %}
7 <p
8 {% if field.errors %} class="error"{% endif %}
9 {% ifequal field.name "honeypot" %} style="display:none;"{%
endifequal %}>
10 {% if field.errors %}{{ field.errors }}{% endif %}
11 {{ field.label_tag }} {{ field }}
12 </p>


I don't know how to do ,who can help me ?

Thejaswi Puthraya

unread,
Sep 3, 2008, 11:55:06 AM9/3/08
to Django users

On Sep 3, 8:14 pm, nonight <noni...@gmail.com> wrote:
> I have add (r'^comments/', include('django.contrib.comments.urls')) in
> the urls.py
>
> the codes in the template:
> {% load comments %}
> {% render_comment_form for user %}
>
[snipped]
>
> I don't know how to do ,who can help me ?

Did you try removing the pyc files from the the comments directory and
its sub-directories and check out?

--
Cheers
Thejaswi Puthraya

nonight

unread,
Sep 3, 2008, 10:09:14 PM9/3/08
to Django users
Yes, i have removed the pyc files from the the comments directory, but
there is nothing diffrence.

On 9月3日, 下午11时55分, Thejaswi Puthraya <thejaswi.puthr...@gmail.com>
wrote:

Joshua Jonah

unread,
Sep 3, 2008, 10:18:03 PM9/3/08
to django...@googlegroups.com
Did you upgrade the comments system from the old style?

looks like a reverse issue.

nonight

unread,
Sep 4, 2008, 1:26:50 AM9/4/08
to Django users
no, the comments system is new ,not upgrading from the old style.

nonight

unread,
Sep 5, 2008, 12:54:09 AM9/5/08
to Django users
Oh, it's OK, I droped the database and rebuilt the database.

begray

unread,
Sep 9, 2008, 2:59:05 PM9/9/08
to Django users
It looks like error occurs when django tries to find matching url for
view: django.contrib.comments.views.comments.post_comment
Likely there's something wrong in your urls.py, eg. you've got admin
urls in old style.

please read the following
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin
and check your urls.py

Jarek Zgoda

unread,
Sep 9, 2008, 3:54:39 PM9/9/08
to django...@googlegroups.com
Not necessarily. I had this problem after updating to new comments
framework without removing stale .pyc files. After removing completely
the directory /usr/lib/python2.5/site-packages/django/contrib/comments
and installing Django back again, everything started working.

Wiadomość napisana w dniu 2008-09-09, o godz. 20:59, przez begray:
--
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R&D, Redefine
jarek...@redefine.pl

Reply all
Reply to author
Forward
0 new messages