【问题标题】:Why am I getting this Error in Django notification?为什么我在 Django 通知中收到此错误?
【发布时间】:2011-01-07 23:06:52
【问题描述】:

我正在使用这个:https://github.com/pinax/django-notification/blob/master/docs/usage.txt

所以,我遵循了所有步骤。

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", {})

当然,在我的模板目录中,我创建了“通知”,就像文档说的那样。

/templates/notification/comment_received里面,我有4个文件:

  • full.txt、short.txt、notice.html、full.html

这些文件现在是空白的。他们只是随便说一句。

为什么我在尝试发送通知时收到此错误?

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

【问题讨论】:

    标签: python django templates url


    【解决方案1】:

    您是否包含正确的 URL 配置?看起来 Django 在您的任何 urlconfs 中都找不到 notification_notices...

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

    您应该在您网站的 urls.py 中引用这些内容,例如:

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

    【讨论】:

      【解决方案2】:

      您需要在urls.py 文件中创建一个条目,包括django-nofication urls.py file

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

      有关包含其他 urls.py 文件的更多信息,请参阅 Django docs

      【讨论】:

        猜你喜欢
        • 2011-07-23
        • 2023-01-02
        • 1970-01-01
        • 2019-11-29
        • 1970-01-01
        • 1970-01-01
        • 2015-08-02
        • 2018-10-08
        • 1970-01-01
        相关资源
        最近更新 更多