错误:
ImproperlyConfigured at /exam/selfdo/save_result
The included urlconf '5' does not appear to have any patterns in it. If you see valid patterns in the file
then the issue is probably caused by a circular import.
错误代码:
return redirect(reverse('exam:show_record',answer_record.pk))
url : url(r'^selfdo/show_record/(\d+)$',views.show_record,name='show_record'),
原因:reversef反解析是传递参数的格式不正确
解决:
return redirect(reverse('exam:show_record',args=(answer_record.pk,)))
以元组的方式传递
详见: URL反解析:reverse
本文介绍了一个关于Django框架中URL反解析错误的问题及其解决方案。错误发生在使用redirect和reverse函数时,由于参数传递方式不正确导致。文章详细解释了如何通过调整参数传递格式来解决问题。
3342

被折叠的 条评论
为什么被折叠?



