Reputation: 36317
This is a a basic question but I'm having trouble finding the answer in in docs:
Lets say I have a url like:
http://example.com/part1/part2
and I have:
urlpatterns = patterns('',
# Examples:
url(r'^$', 'xxx', name='yyy'),
)
What part of the url string above is attempted to be matched by the regex between ^
and $
?
I've read through numerous sources and docs including:
Upvotes: 3
Views: 1416
Reputation: 474151
This is stated in the documentation clearly:
The URLconf searches against the requested URL, as a normal Python string. This does not include GET or POST parameters, or the domain name.
For example, in a request to http://www.example.com/myapp/, the URLconf will look for myapp/.
In a request to http://www.example.com/myapp/?page=3, the URLconf will look for myapp/.
The URLconf doesn’t look at the request method. In other words, all request methods – POST, GET, HEAD, etc. – will be routed to the same function for the same URL.
In your case, part1/part2
string would be searched against.
Upvotes: 4