Django:IE 无法加载本地主机或加载速度非常慢
我刚刚开始学习 Django,在我的计算机上构建一个项目,运行 Windows 7 64 位、Python 2.7、Django 1.3。
基本上,无论我写什么,它都会立即加载到 Chrome 和 Firefox 中。但对于 IE(版本 9),它只是停在那里,什么也不做。我可以在 IE 上加载“http://127.0.0.1:8000”并将计算机打开几个小时,但它无法加载。有时,当我刷新几次或重新启动 IE 时,它就会起作用。如果我再次更改代码中的某些内容,Chrome 和 Firefox 会立即反映更改,而 IE 则不会 - 如果它加载页面的话。
到底是怎么回事?我在这里失去了理智......
I'm just starting to learn Django, building a project on my computer, running Windows 7 64-bit, Python 2.7, Django 1.3.
Basically whatever I write, it loads in Chrome and Firefox instantly. But for IE (version 9), it just stalls there, and does nothing. I can load up "http://127.0.0.1:8000" on IE and leave the computer on for hours and it doesn't load. Sometimes, when I refresh a couple of times or restart IE it'll work. If I change something in the code, again, Chrome and Firefox reflects changes instantly, whereas IE doesn't - if it loads the page at all.
What is going on? I'm losing my mind here....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
可能与这个问题有关:
https://code.djangoproject.com/ticket/16099
本质上,开发服务器不是多线程,如果浏览器打开一个连接,然后尝试第二个连接来实际获取数据,它可能会永远挂起。
编辑:
另外,请参阅此问题:
https://code.djangoproject.com/ticket/15178
如果您能提供重现的方法问题,我们也许能够找到解决办法。
另外,如果您可以尝试最新的开发版本并查看是否修复了该问题,我们最近提交了一个新补丁,为 runserver 命令添加了多线程功能。
It might be related to this issue:
https://code.djangoproject.com/ticket/16099
Essentially, the dev server isn't multithreaded, and if the browser opens a connection and then tries a second connection to actually get the data, it can hang forever.
Edit:
Also, see this issue:
https://code.djangoproject.com/ticket/15178
If you can provide a way to reproduce the issue, we may be able to find a fix.
Also, if you could try the latest development version and see if that fixes it, we recently committed a new patch that adds multithreading capability to the runserver command.
不知道你是否也有和我一样的问题。但我在 IE9 上也遇到了相同的白页,显然这是由 html 标签“fieldset”隐藏我的表单引起的。
尝试验证您的 html 代码或检查 html 标签与 IE9 的兼容性。希望有帮助。
I'm not sure if you have the same problem as me. But I also bumped with the same white page on IE9 and apparently it was caused by html tag "fieldset" hides my form.
Try to validate your html code or check html tags compatibility with IE9. Hope it helps.
我正在使用 Windows 7、64 位、django 1.3、py 2.6 进行开发,并且我总是在 IE、Firefox、Safari 和 Chrome 中检查开发服务器的功能。我的最新系统有IE9,我的旧系统有IE8。我还注意到了悬挂问题。我发现当我使用 127.0.0.1:8000 时它挂起并且需要刷新才能工作。如果我使用开发服务器的特定 IP 地址启动开发服务器,问题似乎就消失了。例如 python manage.py runserver 192.168.1.134:8000
似乎是 IE9 特有的东西。如果你用谷歌搜索,就会有更多人看到这个问题。
I am developing with Windows 7, 64bit, django 1.3, py 2.6 and I always check functionality of the Dev server in IE, Firefox, Safari, and Chrome. My newest system has IE9 on it and my old system has IE8. I also noticed the hanging problem. I found that when I used 127.0.0.1:8000 it hung and would take refreshed to get it to work. If I started the Dev server using the specific IP address of my dev server the problem seemed to be gone. For example python manage.py runserver 192.168.1.134:8000
Does seem to be something very specific to IE9. an if you google it more people have been seeing this problem.
我也遇到了这个问题,这个解决方法可以解决。仅适用于 django <= 1.3
http://nedbatchelder.com/blog/201103/quick_and_dirty_multithreaded_django_dev_server.html
@Andrew Barber< br>
编辑
摘要/我是如何做到的:
创建一个名为managec.py (c=concurrent)的文件
将以下代码粘贴到其中:
使用 ./managec.py runserver 8080(或您使用的任何端口)启动您的开发服务器
享受 :)
i had this issue too, this workaround does the fix. works only for django <= 1.3
http://nedbatchelder.com/blog/201103/quick_and_dirty_multithreaded_django_dev_server.html
@Andrew Barber
EDIT
summary/how i did that:
create a file named managec.py (c=concurrent)
paste the following code in there:
start your dev server with ./managec.py runserver 8080 (or whatever port you use)
enjoy :)
有时,当您有不寻常的代码(例如我在 HttpResponse 之前有一行从用户获取输入)时,就会发生这种情况。删除该代码并刷新服务器。它会像魅力一样发挥作用。
Sometimes it happens when you have unusual code like I have a line taking input from the users before HttpResponse. Remove that code and refresh the server. It will work like charm.