views:

20

answers:

0

I'm using django 1.1 on Google App Engine through use_library. No django gae helper, django-nonrel or similar tools are used here. Django handles urls routing, forms validation etc., but I'm using pure appengine models.

In one of my django's forms there is a FileField, which from time to time seems to call django.core.files.uploadedfile.TemporaryUploadedFile. This class next uses tempfile.NamedTemporaryFile and this results in appengine raising:

File "/base/python_runtime/python_dist/lib/python2.5/tempfile.py", line 45, in PlaceHolder
   raise NotImplementedError("Only tempfile.TemporaryFile is available for use")

Trying to solve this problem I took uploadedfile module from Google App Engine Helper for Django (which doesn't use NamedTemporaryFile) saved it as gae_uploadedfile.py in application directory and in my djangomain.py file I added:

from google.appengine.dist import use_library
use_library('django', '1.1')
(...)
import gae_uploadedfile
django.core.files.uploadedfile = gae_uploadedfile

djangomain.py is a file where i redirect all urls - in app.yaml I have:

- url: /.*
  script: djangomain.py

But it didn't help, I still get this exception. What am I doing wrong, is there other solution to avoid this error while using FileField from django.forms?