django 的开发服务器在 OSX 上有时非常慢

发布于 2024-11-01 03:35:54 字数 1314 浏览 2 评论 0原文

当我运行时:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丑疤怪 2024-11-08 03:35:54

静态媒体拖慢了我的速度,所以我现在通过 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

把人绕傻吧 2024-11-08 03:35:54

在 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文