学习django过程中遇到的issue: Exception Type: NoReverseMatchException Value: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found.

1.使用教程学习的时候,会遇到修改链接的硬编码的问题

2.修改后发先一直会提示错误

Exception Type: NoReverseMatchException Value: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found.

3.一直怀疑是urls的正则表达式错误,或者域名空间的问题

4.经过查询发现是 使用question_id代替了question.id

In your index.html you gave poll_id as an argument, but that's just the name the argument will have within the detail function; it is not defined in your template. The actual value you want to call the function with is probably poll.id.


学习django过程中遇到的issue: Exception Type: NoReverseMatchException Value: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found._第1张图片

至此这个问题得以解决

你可能感兴趣的:(学习django过程中遇到的issue: Exception Type: NoReverseMatchException Value: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found.)