Here is my loader class, ItemLoader.py:
from google.appengine.ext import db
from google.appengine.tools import bulkloader
import models
class ItemLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Item', [('CSIN', int), # not too DRY...
('name', str),
('price', int),
('quantity', int)
]
)
loaders = [ItemLoader]
Here is my kind implementation, models.py:
from google.appengine.ext import db
class Item(db.Model):
CSIN = db.IntegerProperty()
name = db.StringProperty()
price = db.IntegerProperty() # OK that it's an int?
quantity = db.IntegerProperty()
These are essentially copied from GAE instructions. When I run appcfg.py
, I get this error:
ImportError: No module named models
What am I doing wrong? If I take out that import statement, I get a different error:
... No implementation for kind 'Item'
UPDATE 1: I tried copy/pasting directly from Google's instructions, and I get that same import error.
UPDATE 2: Changed the name of the kind implementation to models.py
. Still doesn't work. Both ItemLoader.py
and models.py
are in the same directory.
UPDATE 3: hacky solution: put them both in the same file! It works, but what am I not understanding about imports?