2012-06-30 66 views
0

添加具有ImageField的窗体后,我在我的网站上收到MemoryError。该代码在我的开发服务器(OS X 10.7.4)上正常工作,但在暂存环境(CentOS)中失败。使用Python成像库(PIL)时Django MemoryError

我有点不情愿使用这里提出的解决方案,看起来像一个类似的问题:Python ctypes MemoryError in fcgi process from PIL library。它改变了python本身 - 这对于长期维护似乎不利。

我是如何调试这一个有点无能......请帮我治好我的无知,

这里是回溯:

Environment: 


Request Method: POST 
Request URL: http://myschoolzoneapp.eatechinc.com/debug/ 

Django Version: 1.4 
Python Version: 2.7.3 
Installed Applications: 
('django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.sites', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'django.contrib.admin', 
'accounts', 
'announcements', 
'api', 
'devices', 
'events', 
'menus', 
'organizations', 
'djangorestframework', 
'registration', 
'guardian', 
'south', 
'profiles') 
Installed Middleware: 
('django.middleware.common.CommonMiddleware', 
'django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.messages.middleware.MessageMiddleware', 
'ischoolhub_project.middleware.ProcessMiddleware') 


Traceback: 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/core/handlers/base.py" in get_response 
    111.       response = callback(request, *callback_args, **callback_kwargs) 
File "/home/eatech/django/projects/ischoolhub-staging/ischoolhub_project/views.py" in debug 
    22.   if form.is_valid(): 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/forms.py" in is_valid 
    124.   return self.is_bound and not bool(self.errors) 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/forms.py" in _get_errors 
    115.    self.full_clean() 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/forms.py" in full_clean 
    270.   self._clean_fields() 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/forms.py" in _clean_fields 
    285.      value = field.clean(value, initial) 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/fields.py" in clean 
    535.   return super(FileField, self).clean(data) 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/fields.py" in clean 
    153.   value = self.to_python(value) 
File "/tmp/egg-cache/Django-1.4-py2.7.egg/django/forms/fields.py" in to_python 
    560.    import Image 
File "/tmp/egg-cache/PIL-1.1.7-py2.7-linux-i686.egg/Image.py" in <module> 
    45.  __import__("FixTk") 
File "/usr/local/lib/python2.7/lib-tk/FixTk.py" in <module> 
    15.  import ctypes 
File "/usr/local/lib/python2.7/ctypes/__init__.py" in <module> 
    555. _reset_cache() 
File "/usr/local/lib/python2.7/ctypes/__init__.py" in _reset_cache 
    279.  CFUNCTYPE(c_int)(lambda: None) 

Exception Type: MemoryError at /debug/ 
Exception Value: 

回答