Url regex in django

This is a basic question, but I am having a hard time finding an answer in the docs:

Let's say I have a url:

http://example.com/part1/part2

      

and I have:

urlpatterns = patterns('',
    # Examples:
    url(r'^$', 'xxx', name='yyy'),

)

      

What part of the url string above is trying to match the regex between ^

and $

?

I have read numerous sources and docs including:

+3


source to share


1 answer


This is clearly stated in the documentation :

URLconf searches the requested URL like a normal Python string. This does not include GET or POST parameters, or domain name.

For example, in a request for http://www.example.com/myapp/ , the URLconf will look for myapp /.

In a request for http://www.example.com/myapp/?page=3, the URLconf will look for myapp /.

URLconf doesn't look at the request method. In other words, all request methods are POST, GET, HEAD, etc. - will be directed to the same for the same URL.



In your case, the string part1/part2

will be searched.

+4


source







All Articles