简体   繁体   中英

Why am I getting this Error in Django notification?

I'm using this one: https://github.com/pinax/django-notification/blob/master/docs/usage.txt

So, I followed all the steps.

from notification import models as notification

#first, create the notification type.
notification.create_notice_type("comment_received", ("Comment Received"), ("You have received a comment."))

#then, send the notification. 
notification.send(request.user, "comment_received", {})

Of course, in my template directory, I created "notification", just like the doc says.

Inside /templates/notification/comment_received , I have 4 files:

  • full.txt, short.txt, notice.html, full.html

These files are blank right now. They just say a random sentence.

Why am I getting this error when I try to send the notification?

Exception Type: NoReverseMatch at /
Exception Value: Reverse for 'notification_notices' with arguments '()' and keyword arguments '{}' not found.

Did you include the proper URL configurations? Looks like Django can't find notification_notices in any of your urlconfs...

https://github.com/pinax/django-notification/blob/master/notification/urls.py

You should reference these in your site's urls.py, eg:

urlpatterns = patterns('',
    (r'^notification/', include(notification.urls)),
...

You will need to create an entry in your urls.py file including the django-nofication urls.py file :

(r'^notifications/', include('notification.urls')),

See the Django docs for more information on including other urls.py files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM