擅长:python、mysql、java
<p>问题出在你的url调度程序中。
当django继续向dispatcher发送url时,它会从上到下逐个抛出您的url,如果存在regexp匹配则停止。在</p>
<p>您在<code>(r"", "main"),</code>中的url <code>""</code>与所有字符串匹配。
您需要将其替换为<code>(r"^$", "main"),</code>以匹配空字符串。在</p>
<p>更多信息:</p>
<ul>
<li><a href="https://docs.djangoproject.com/en/1.8/topics/http/urls/" rel="nofollow">https://docs.djangoproject.com/en/1.8/topics/http/urls/</a></li>
<li><a href="https://docs.python.org/3.4/library/re.html" rel="nofollow">https://docs.python.org/3.4/library/re.html</a></li>
</ul>