-1

I have the following line in my src/urls.py

(r'^nomundo', include('interviews.urls')),

and in my src/interviews/urls.py I have the following:

r'/$', 'interviews.views.interviews'),

This construction allows me to access URLs such as /nomundo/blablabla/trololo/foo/bar, or any other with as many /something as I want.

I would like these to raise a 404 error.

How can I specify my regexp to do so? Or the solution is something else?

Thank you for your time.

Francisco
  • 1,352
  • 4
  • 13
  • 27
  • This makes no sense. It's matching because you allowed it match pretty much anything on purpose. Now you want *what* exactly to raise a 404? All of these extended URLs? Then just make your urlpattern more restrictive. Without more information, though, there's no way to really help you. – Chris Pratt May 02 '12 at 20:50
  • I don't understand why you negativate my question. Yes, I want "All of these extended URLs" to raise a 404. I allowed them to match because I don't know how not to do so. That's Why I asked the question. I know that there is a problem in my url matching. What other information do you need? You say "Then just make your urlpattern more restrictive". If you tell me how to do it, you are answering my question and helping me. Sorry If my question is not clear enough, but i thought it was. – Francisco May 02 '12 at 21:15

1 Answers1

2

You forgot to root your sub-URL so that it starts at the beginning of the string.

(r'^$', 'interviews.views.interviews')

Note that you usually include the initial slash in the parent's url, which is why I haven't included it above:

(r'^nomundo/', include('interviews.urls')),
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895