django在我的机器上非常慢 [英] django is very slow on my machine

查看:113
本文介绍了django在我的机器上非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的安装的django 1.0,一个简单的页面从它需要5秒加载。在我的同事的电脑上,几乎没有时间。



我使用

 $ b启动服务器$ b python manage.py testserver 

我可以看到每个GET请求(PNG和样式表)大约需要半秒钟。 >

我认为相关的另一个奇怪的事情是,使用MySQL的机器,该应用程序的功能测试运行速度要慢得多(比同事的机器慢100倍) )。当我将应用程序设置为使用sqlite时,它们运行得很快。我想强调,sqlite不会改变加载页面所需的时间,但它会加快服务器启动时间。



它看起来像IO问题,但是我至少看不到django上的一般性能问题。



Django运行在python2.4上,我正在运行Vista。我也检查过python2.5。



谢谢ΤΤΩΩΖΥΥΥΥΥΥΥΥ<<<<<<<<<<<<<<<<<< a href =http:// localhost:8000 / app =noreferrer> http:// localhost:8000 / app 我去 http://127.0.0.1:8000/app



但是这可能是什么原因?我的主机文件只有两个条目:

 
127.0.0.1 localhost
:: 1 localhost


解决方案

Firefox在某些Windows机器上浏览本地主机时遇到问题。您可以通过关闭ipv6来解决这个问题,这不是真正的建议。直接使用127.0.0.1是另一种解决问题的方法。


I have a fresh install of django 1.0 and a simple page served from it takes 5 secs to load. On my colleague's computer it takes almost no time.

I start the server using

python manage.py testserver

I can see each GET request (PNGs and style sheets) take about half a second.

Another weird thing, which I think is related, is that the functional tests for the app run much slower on my machine with MySQL (on order of 100 times slower than on my colleague's machine). When I set the app to use sqlite, they run pretty quickly. I would like to exclaim that sqlite doesn't much change the time it takes to load a page, but it does speed up server startup.

It looks like IO problem, but I don't see general performance problems on my machine, apart from django at least.

Django runs on python2.4, I'm running Vista. I have also checked python2.5.

Thanks ΤΖΩΤΖΙΟΥ, It must totaly be a DNS problem, because the page loads up quickly as soon as instead of http://localhost:8000/app I go to http://127.0.0.1:8000/app.

But what could it be caused by? My host file has only two entries:

127.0.0.1   localhost
::1         localhost

解决方案

Firefox has a problem browsing to localhost on some Windows machines. You can solve it by switching off ipv6, which isn't really recommended. Using 127.0.0.1 directly is another way round the problem.

这篇关于django在我的机器上非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆