url error

30 views
Skip to first unread message

Cristiano Araujo

unread,
Feb 5, 2014, 9:13:39 PM2/5/14
to django...@googlegroups.com
hello guys

this is my url.py

urlpatterns = patterns('blog.views',
    url(r'^$', ListView.as_view(
                           queryset=Post.objects.all().order_by("-created")[:2],
                           template_name="blog.html")),
    url(r'^(?P<pk>\d+)$', DetailView.as_view(
                           model=Post,
                           template_name="post.html")),
    url(r'^archives/$', ListView.as_view(
                           queryset=Post.objects.all().order_by("-created"),
                           template_name="archives.html")),
    url(r'^tag/(?P<tag>\w+)$', 'tagpage'),
    url(r'^feed/$', BlogFeed()),
                           
)


but it calls the url this way


http://127.0.0.1:8000/blog/tagLondon

the right way would be this:


someone can help me to fix this?

Cristiano Araujo

unread,
Feb 5, 2014, 9:15:07 PM2/5/14
to django...@googlegroups.com
the message error:

Using the URLconf defined in webapp.urls, Django tried these URL patterns, in this order:

  1. ^blog/ ^$
  2. ^blog/ ^(?P<pk>\d+)$
  3. ^blog/ ^archives/$
  4. ^blog/ ^tag/(?P<tag>\w+)$
  5. ^blog/ ^feed/$
  6. ^admin/
The current URL, blog/tagLondon, didn't match any of these. 

Babatunde Akinyanmi

unread,
Feb 6, 2014, 1:52:51 AM2/6/14
to Django users

Ji Cristiano.  You show the code that is not behaving as you expect

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6b64738-fb29-4bd1-86c1-4c30dd1992a8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Cristiano Araujo

unread,
Feb 6, 2014, 6:33:39 AM2/6/14
to django...@googlegroups.com
yeah, i found the error. just a slash unnecessary 

url(r'^tag/(?P<tag>\w+)$', 'tagpage'),

 url(r'^tag(?P<tag>\w+)$', 'tagpage'),
            ^


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/3eX9CDLmNE4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/groups/opt_out.



--

Reply all
Reply to author
Forward
0 new messages