Lorenzo
Lorenzo

Reputation: 4648

Regex to match given URL

Been stuck with this for a long time already. I have a URL like the following:

http://localhost:8000/foobar/0/ec8b6cf5203c6ce57521155fea4f96a53e0fadb5/

The last part of the URL is a SHA1 hex representation. My urls.py looks like this:

url(r'^/foobar/[0-9]/[a-z0-9]{40}/$', 'baz.views.foobar')

Could someone please help me spot why the URL isn't getting matched to this urls.py entry?

Upvotes: 0

Views: 464

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599560

You shouldn't try to match against the initial / - that's counted as part of the domain, or the previous urlconf if this is an include.

Upvotes: 1

Related Questions