revy revy - 1 month ago 8
Python Question

URL parameters with GET request in django

guys. I'm passing parameters via GET requests to my view. But it seems that django is not properly handling my URL.

With parameters longer than one char, it works, but if I use a single char, I get Page not found (404) error.

Example:

Works: http://localhost:8000/my_url/test

Not found: http://localhost:8000/my_url/t

urls.py code fragment:

url(r'^my_url/(?P<username>\w.+)/$', views.my_url, name='my_url'),


Is there any django restriction to the length of parameters passed via GET?
Thanks a lot in advance!

Answer

Remove dot from regex string r'^my_url/(?P<username>\w+)/$'