【发布时间】:2011-08-16 09:31:06
【问题描述】:
我一直在 Ubuntu 10.10 上使用 Django 1.3 和 Python 2.6。我有 3 个问题。
- 我记得不久前使用 Django 时在 Windows 7 上遇到过这个问题。不过,我也记得我第一次使用 Django 的时候并没有出现这个问题。
当我通过127.0.0.1:8000 访问 Django 时,在开始一个全新的项目后,我可以访问该站点,但有时需要 10-20 秒,有时需要更长的时间才能到达。此外,在一个我几乎没有参与过的项目中,我遇到了同样的问题,并且还会出现以下错误:
Exception happened during processing of request from ('127.0.0.1', 47758)
Traceback (most recent call last):
File "/usr/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/servers/basehttp.py", line 570, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
self.finish()
File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
self.wfile.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
此外,每当我遇到错误时,我希望dcramer's django-sentry 将错误记录在数据库中,但是当我进入 MySQL 并检查表时,那里什么也没有。我按照网站上的说明安装了该应用程序。
-
我把它放在了我的 urls.py 文件中:
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/user/apache2/www/django/ecomstore/static',})
但是,当我转到127.0.0.1:8000/static/css.css 时,我找不到我放在文件夹中的文件。我做错了什么?
感谢大家的帮助!
【问题讨论】:
标签: python django performance