【发布时间】:2011-05-26 21:37:07
【问题描述】:
我无法从我的 URL 中提取字符串。这就是我得到的......它一直在 404ing。
urls.py:
urlpatterns = patterns('',
(r'^user/(?P<username>\w{0,50})/$', profile,),
)
views.py:
def profile(request, username):
...
return ...
看到什么明显的东西了吗?需要更多?任何帮助表示赞赏。
【问题讨论】:
-
你在 URL 中给出的字符串是什么?
-
domain/accounts/user/foobar(这个 urls.py 在 /accounts/ 中)
-
你是在末尾添加斜线吗?
-
我可以通过任何方式,它仍然是 404s。
-
啊哈。问题不在这里。它在我的主 urlconf 上面,我有一个终止 $。感谢你们的聪明才智。
标签: python regex django urlconf