URL配置错误Django

hln*_*hln 2 python django urlconf

我有一个链接

 a href="editYou/{{costumer.slug}}"
Run Code Online (Sandbox Code Playgroud)

和URL parttern

(r'editYou/<?P(costumerSlug>.*)/$', 'editYou'),
Run Code Online (Sandbox Code Playgroud)

这指向方法

def editYou(request, costumerSlug):
Run Code Online (Sandbox Code Playgroud)

但Django显示错误:

The current URL, profile/editYou/es, didn't match any of these.
Run Code Online (Sandbox Code Playgroud)

你怎么帮我找到是什么原因?

awe*_*oon 5

你的模式是错的,它应该是

r'editYou/(?P<costumerSlug>.*)/$'
#         ^^^^
#   not   <?P(costumerSlug>.*)
Run Code Online (Sandbox Code Playgroud)