I'm having difficulty getting couchdbkit to function properly on Google App Engine. I'm either not importing my libraries correctly or I've run afoul of GAE's Python Sandbox rules. Anyone know if I need to include restkit when using couchdbkit on GAE (that's where some of the problems are coming from)?
Here's my configuration:
app.yaml
zapdome.py
couchdbkit/
restkit/
I've stripped zapdome.py to just the basics (connect to my CouchDB database server):
#! /usr/bin/env python
import urllib, httplib, datetime
from couchdbkit.schema.base import *
from couchdbkit.schema.properties import *
from couchdbkit.client import Server
USERNAME = ''
PASSWORD = ''
class QuoteEntry(Document):
name = StringProperty()
symbol = StringProperty()
price = StringProperty()
server = Server('https://' + USERNAME + ':' + PASSWORD + '@' + USERNAME + '.cloudant.com/')
These are the errors I'm logging:
E 2011-05-05 20:39:31.309
Traceback (most recent call last):
E 2011-05-05 20:39:31.309
File "/base/data/home/apps/zapdome/1.350215157753999092/restkit/__init__.py", line 12, in <module>
E 2011-05-05 20:39:31.309
from .client import Client, MAX_FOLLOW_REDIRECTS
E 2011-05-05 20:39:31.309
File "/base/data/home/apps/zapdome/1.350215157753999092/restkit/client.py", line 21, in <module>
E 2011-05-05 20:39:31.309
from httplib import FakeSocket
E 2011-05-05 20:39:31.309
ImportError: cannot import name FakeSocket
E 2011-05-05 20:39:31.309
Traceback (most recent call last):
E 2011-05-05 20:39:31.309
File "/base/data/home/apps/zapdome/1.350215157753999092/couchdbkit/__init__.py", line 10, in <module>
E 2011-05-05 20:39:31.310
from .resource import RequestFailed, CouchdbResource
E 2011-05-05 20:39:31.310
File "/base/data/home/apps/zapdome/1.350215157753999092/couchdbkit/resource.py", line 25, in <module>
E 2011-05-05 20:39:31.310
from restkit import Resource, ClientResponse
E 2011-05-05 20:39:31.310
ImportError: cannot import name Resource
E 2011-05-05 20:39:31.310
<type 'exceptions.SyntaxError'>: 'import *' not allowed with 'from .' (__init__.py, line 159)
Traceback (most recent call last):
File "/base/data/home/apps/zapdome/1.350215157753999092/zapdome.py", line 4, in <module>
from couchdbkit.schema.base import *
Since it's choking on httplib.FakeSocket and restkit.Resource, I'm beginning to think I'm going outside the bounds of what GAE permits. Anyone have any thoughts? Thanks.
I hate to answer my own question, but it appears I was trying to do things outside the confines of GAE's Python Sandbox. I think it took issue with the socket stuff. The good folks at Cloudant pointed me to this Quora answer that lays out more liberal hosting options for Python/Django.
BTW, I went with WebFaction and got everything working fine within an hour and I'm definitely no sys admin (but they do not offer a free hosting solution).