11
votes

If I comment out the handlers that use djangoforms everything else seems to work.

The following is my modified app.yaml:

application: xxxxxxx
version: 5
#` -1+1
# runtime: python
runtime: python27
api_version: 1

inbound_services:
- mail

#` +3
libraries:
- name: django
  version: "1.2"

handlers:
- url: /(.*\.(html|css|js|gif|jpg|png|ico))
  static_files: static/\1
  upload: static/.*
  expiration: "1d"
  # expiration: "1m"

- url: .*
  script: main.py

- url: /_ah/mail/.+
  script: lib/handler_mail.py
  login: admin

The following is the excerpt from main.py that I modified:

import os
# dummy, enables django template filters to be registered
os.environ[u'DJANGO_SETTINGS_MODULE'] = u'conf'
#` -2
# from google.appengine.dist import use_library
# use_library('django', '1.2')

from functools import wraps
from appengine_utilities.cache import Cache
from google.appengine.api import taskqueue
from google.appengine.ext.db import djangoforms
...

Here's the trace back from my log: Traceback (most recent call last): File "/base/data/home/apps/s~cirrussecure1/5.354034990641807540/main.py", line 23, in from google.appengine.ext.db import djangoforms ImportError: cannot import name djangoforms

Something I'm doing won't let me import djangoforms but doesn't affect anything else. I Googled it but no one else seems to be having a problem (yet?). Thanks.


@all Found a solution that keeps me going on gae/python 2.7 but I don't like it or the way google handled this part of the release.

I tried wtforms and made some progress trying to get it going with gae/python 2.5 before calling enough.

I then got djangoforms.py (from http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/ext/db/djangoforms.py), dropped it in with my files, and got it to work with gae/python 2.7.

I used the app.yaml shown above. Also had to change {{ form_section }} to {{ form_section|safe }} in two template files.

I guess Django is falling out of favor with the gae team. I could understand if djangoforms was deprecated for a year and then dropped. However, dropping it with out any warning or even any mention in the doc.'s comparing the current release with the previous just isn't a nice thing to do to your customers.

@google Please update your, doc.'s, articles, examples, etc. so others don't have to waste a day like I did.

2
Were you able to see these errors in your dev sandbox? I see them only in production, but my dev sandbox works fine, which is annoying for debugging things.dfrankow
I'm currently running into this problem as well and I'm looking at either patch in more django and more django forms like preview etc using www.allbuttonspressed.com or like Nick Johnson says choose a specific form frameworkNiklas R.

2 Answers

9
votes

The google.appengine.ext.db.djangoforms module is not provided with the Python 2.7. You could patch in a copy yourself, but a better idea would be to modify your form handling code to not rely on it - it's unsupported and frankly a bit of a hack.