를 작동하는 방법에 대해 오해하는 것은 나의 로더 클래스, 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]
내 종류의 구현, 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()
기본적으로 GAE instructions에서 복사됩니다.
ImportError: No module named models
내가 잘못 뭐하는 거지 : 내가 appcfg.py
를 실행하면,이 오류가? 나는 구글의 지침에서 직접 복사/붙여 넣기를 시도, 나는 같은 가져 오기 오류 :
... No implementation for kind 'Item'
UPDATE 1 : 그 import 문을 가지고가는 경우에, 나는 다른 오류가 발생합니다.
업데이트 2 : 종류 구현의 이름이 models.py
으로 변경되었습니다. 아직도 작동하지 않습니다. ItemLoader.py
과 models.py
은 모두 같은 디렉토리에 있습니다.
업데이트 3 : 해킹 된 해결책 : 두 파일을 같은 파일에 저장하십시오! 그것은 효과가 있지만 수입에 대해 무엇을 이해하지 못합니까?
그 ItemLoader 클래스는'models.py'와 같은 디렉토리에있는'.py' 파일로 어디에서 살고 있습니까? 오류에서 그것은 그렇지 않은 것처럼 보일 것입니다. –
@Alex 두 파일은 같은 디렉토리에 있습니다 (위 참조). –
그리고 appcfg를 실행할 때 해당 디렉토리가 현재 디렉토리입니까? 그렇지 않으면 아래의 대답과 같이 비단뱀 경로를 변경해야합니다. –