It also seems that the space preceding the caret ^ should not be there

So

^blog/ ^(?P<year>\d{4})/$

Should be

^blog/^(?P<year>\d{4})/$





-----Original Message-----
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of jnns
Sent: 20 February 2011 03:07
To: Django users
Subject: Re: urls.py and views.generic issue



Hi Antti,



the url patterns in the tutorial are not correct. The regular

expressions are not using character classes but merely plain

characters.



^blog/ ^(?P<year>d{4})/$

should be

^blog/ ^(?P<year>\d{4})/$



Mind the backslash in \d{4}. This way we're matching for a sequence of

four digits and not for a sequence of four "d"s.



Regards,

jnns



On Feb 20, 12:57 am, Antti <ahpetai...@gmail.com> wrote:

> The problem:

>

> I can't seem to get most of my urls that I type in my browser to math

> a url in my urls.py file.  I am currently doing Web Monkey's Blog

> Tutorial (http://www.webmonkey.com/2010/02/Get_Started_With_Django/)

> To date everything has worked but when I try to use the urls from the

> blog urls.py I get the following error:

>

> Using the URLconf defined in anttipetaisto.urls, Django tried these

> URL patterns, in this order:

>

> ^admin/doc/

> ^admin/

> ^blog/ (?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]

> +)/$

> ^blog/ ^(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-

> w]+)/$

> ^blog/ ^(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/$

> ^blog/ ^(?P<year>d{4})/(?P<month>[a-z]{3})/$

> ^blog/ ^(?P<year>d{4})/$

> ^blog/ ^$

> ^tags/(?P<slug>[a-zA-Z0-9_.-]+)/$

> ^static_files/(?P<path>.*)$

>

> The current URL, blog/2011/jan/20/things-learned-finland/, didn't

> match any of these.

>

> What I don't understand why this is saying that isn't a url match.

> Shouldn't it match the third one down?

>

> Thanks

>

> Antti



--

You received this message because you are subscribed to the Google Groups 
"Django users" group.

To post to this group, send email to django-users@googlegroups.com.

To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.

For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to