我正在开发一个 Django 网络项目。前一刻一切都很好,但突然间 django localhost 服务器保持自身重新加载,而不是停止自动重新加载页面。首先我收到以下错误:connectionreseterror: (errno 104) connection reset by peer 而服务器只是一遍又一遍地重新加载自己。这可能是什么原因?任何帮助将不胜感激。
答案 0 :(得分:0)
你的 Django 包版本是什么?
像你这样的django项目有例外 https://github.com/django/django/commit/934acf1126995f6e6ccba5947ec8f7561633c27f
尝试将 django 更新到最新版本
pip install --update django
答案 1 :(得分:0)
已解决。 我使用 JQuery 自动完成从后端搜索数据,并希望实现将用户重定向到该特定项目页面的 onclick 功能。
$(document).ready(function() {
$("#search").autocomplete({
source: "{% url 'ajax-search' %}",
select: function (event, ui) {
window.location.href = ui.item.value;
}
})
window.location.href = ''
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<div class="search">
<label for="search"></label><input type="text" oninput="" style="height: 36px" class="searchTerm"
placeholder="What are you looking for?" name="searchtext"
id="search"><input type="hidden" id="project-id">
<button type="submit" class="searchButton">
<i class="fa fa-search"></i>
</button>
</div>
问题是一致的:
window.location.href = ''
我删除了那行代码,现在一切都很好:)