I have a urls.py. One of them says this line:
(r'^notification/?$',include("notification.urls")),
I'm supposed to do that because I installed "django_notification" (and added "notification") to INSTALLED_APPs.
开发者_C百科Great! going to /notification/ works! This is the urls.py in the notification module:
from django.conf.urls.defaults import *
from notification.views import notices, mark_all_seen, feed_for_user, single, notice_settings
urlpatterns = patterns('',
url(r'^$', notices, name="notification_notices"),
url(r'^settings/$', notice_settings, name="notification_notice_settings"),
url(r'^(\d+)/$', single, name="notification_notice"),
url(r'^feed/$', feed_for_user, name="notification_feed_for_user"),
url(r'^mark_all_seen/$', mark_all_seen, name="notification_mark_all_seen"),
)
However, only /notification works and it displays the word "notice" when I hit that url. Nothing else works. /settings, /feed. None of that work. I get a 404 error that Django tried all the URLs in order.
Perhaps it's because of the "notification_notice" thing??
If you read the documentation, you'll see that the include will remove the part that matches, so you'd have to go to /notification/settings, and /notification/feed
Solved.
I removed the ?$
at the end of the url match.
精彩评论