django 的开发服务器在 OSX 上有时非常慢
当我运行时:
python manage.py runserver
开发服务器启动时没有错误消息,但有时加载页面时只会挂起一两分钟,然后加载页面非常缓慢。我运行 OSX 10.6.6、virtualenv、django 1.3、python 2.6.1、mysql。在 3 台不同的 Mac 上进行多个项目。
还有其他人有同样的问题吗?
有时我会看到这样的情况:
Traceback (most recent call last):
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 284, in run
self.finish_response()
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 324, in finish_response
self.write(data)
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 403, in write
self.send_headers()
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 467, in send_headers
self.send_preamble()
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 385, in send_preamble
'Date: %s\r\n' % http_date()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 297, in write
self.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 284, in flush
self._sock.sendall(buffer)
error: [Errno 32] Broken pipe
When I run:
python manage.py runserver
The development server starts up with no error messages but sometimes when loading a page will just hang for a min or two then very slowly load the page. Im running OSX 10.6.6, virtualenv, django 1.3, python 2.6.1, mysql. Happening on more than one project on 3 different macs.
Anyone else having the same issue?
Occasionally I'm seeing this:
Traceback (most recent call last):
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 284, in run
self.finish_response()
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 324, in finish_response
self.write(data)
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 403, in write
self.send_headers()
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 467, in send_headers
self.send_preamble()
File "/Users/x/webdev/99/svn/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 385, in send_preamble
'Date: %s\r\n' % http_date()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 297, in write
self.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 284, in flush
self._sock.sendall(buffer)
error: [Errno 32] Broken pipe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
静态媒体拖慢了我的速度,所以我现在通过 apache 为它们提供服务。问题解决了。
让 Django 开发服务器更快地提供静态媒体
It was static media slowing me down so I now serve them via apache. Problem solved.
Making Django development server faster at serving static media
在 OSX 上使用 Django 没有任何问题,并用它制作了几个项目。
正如 tiagoboldt 建议的那样,您可能需要检查代码是否存在瓶颈。调试工具栏有助于分析查询性能。
http://jacobian.org/writing/django-performance-tips 也有一些好的建议/
Had no problems with Django on OSX and made several projects with it.
As tiagoboldt suggested you might want to check the code for bottle necks. The debug toolbar helps to analyze query performance.
Also there's some good advice at http://jacobian.org/writing/django-performance-tips/