python - URL 配置错误 Django

标签 python django urlconf

我有链接

 a href="editYou/{{costumer.slug}}"

和 URL 部分

(r'editYou/<?P(costumerSlug>.*)/$', 'editYou'),

指向方法

def editYou(request, costumerSlug):

但是 Django 显示错误:

The current URL, profile/editYou/es, didn't match any of these.

你怎么帮我看看是什么原因?

最佳答案

你的模式错了,应该是

r'editYou/(?P<costumerSlug>.*)/$'
#         ^^^^
#   not   <?P(costumerSlug>.*)

关于python - URL 配置错误 Django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16099885/

相关文章:

centos服务器中的django部署

django - 在 django.core.urlresolvers reverse() 调用中包含查询字符串

django - 在 Django 1.11 中,当在项目 URLconf 文件中包含应用程序 URLconf 文件时出现循环导入错误

python - 将基于 'sh 1.11' 的代码移植到 Windows

python - 使用 Scrapy 爬取带有 JavaScript 的站点

python - 已安装 MacPort 但命令出错

python - 执行ssh命令中嵌入的tar命令

python - Folium map 未在 Django 网页中显示

python - 将函数结果传递到 Django 中的 html