Regexes are tricky if you're new to them.

^record/$ matches 'record/'

^record/(\d{3})/$ matches 'record/, then three digits, then '/'

^record/(?P<record_name>\d+)/$ matches 'record/', then one digit
stored as a value that can be passed to django, then '/'

Check this out:

http://www.regular-expressions.info/

Franklin



On Fri, Jul 23, 2010 at 11:27 AM, deepak dhananjaya
<deepak.dhananj...@gmail.com> wrote:
> My URLS.PY
> has
> urlpatterns = patterns('',
>    (r'^record/$', 'phonebook.record.views.showlist'),
>    (r'^record/(\d{3})/$', 'phonebook.record.views.testrecord'),
>    (r'^record/(?P<record_name>\d+)/$',
> 'phonebook.record.views.showRecord'),
>    #(r'^record/(?P<name>\d+)/$', 'phonebook.record.views.showlist'),
>    # Example:
>    # (r'^phonebook/', include('phonebook.foo.urls')),
>
>    # Uncomment the admin/doc line below and add
> 'django.contrib.admindocs'
>    # to INSTALLED_APPS to enable admin documentation:
>    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
>    # Uncomment the next line to enable the admin:
>    (r'^admin/', include(admin.site.urls)),
> )
>
>
> and i m trying to access the app like:
>
> http://localhost:8000/record/john/
>
> I get this error:
> Request Method: GET
> Request URL: http://localhost:8000/record/john/
>
> Using the URLconf defined in phonebook.urls, Django tried these URL
> patterns, in this order:
>
> ^record/$
> ^record/(\d{3})/$
> ^record/(?P<record_name>\d+)/$
> ^admin/
> The current URL, record/john/, didn't match any of these.
>
>
> Please help me with this!!
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
Art, writing, journal: http://einspruch.com
Comics: http://themoonfellonme.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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