为什么我在 Django 通知中收到此错误?

发布于 2024-10-11 03:10:54 字数 931 浏览 2 评论 0 原文

我正在使用这个: 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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

已下线请稍等 2024-10-18 03:10:54

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

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

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

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

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, e.g.:

urlpatterns = patterns('',
    (r'^notification/', include(notification.urls)),
...
盗梦空间 2024-10-18 03:10:54

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

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

请参阅 Django 文档 了解有关包含其他 urls.py 文件的更多信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文