0

I'm trying to use the bulk uploader in my development environment and I'm running into problems. Here is the error I'm getting:

  File "volume_loader.py", line 3, in <module>
    import model
ImportError: No module named model

I'm in my application directory, called "src" when I run this command:

appcfg.py upload_data --config_file=volume_loader.py --filename=lds_scriptures_volumes.csv --kind=Volume --url=http://localhost:8080/_ah/remote_api

Here is my volume_loader.py. (which is sitting in my src directory)

from google.appengine.ext import db
from google.appengine.tools import bulkloader
import model

class VolumeLoader(bulkloader.Loader):
    def __init__(self):
        bulkloader.Loader.__init__(self, 'Volume',
                                   [('volume_id', int),
                                    ('volume_title', str),
                                    ('volume_title_long', str),
                                    ('volume_subtitle', str),
                                    ('lds_org', str),
                                    ('num_books', int),
                                    ('num_chapters', int),
                                    ('num_verses', int)
                                   ])

loaders = [VolumeLoader]

In my model.py file I have defined a "Volume" which is what I'm trying to import:

class Volume(Base):
  volume_id = ndb.IntegerProperty(required=True)
  volume_title = ndb.StringProperty(required=True)
  volume_title_long = ndb.StringProperty(required=True)
  volume_subtitle = ndb.StringProperty(required=True)
  lds_org = ndb.StringProperty(required=True)
  num_books = ndb.IntegerProperty(required=True)
  num_chapters = ndb.IntegerProperty(required=True)
  num_verses = ndb.IntegerProperty(required=True)

Any ideas why the model can't be found from the volume_loader?

4

1 回答 1

0

好吧,我想我找到了答案,但看起来我无论如何都无法使用批量上传器,因为我的对象使用 ndb。

请参阅以下答案:

bulkloader 不导入 ndb.model

通过批量导出器/批量上传器下载应用程序引擎 ndb 实体

于 2013-09-03T16:55:44.020 回答