在我的 model.py 中,我正在导入图像以生成图片的 url,如下所示。
from google.appengine.api import images
class Picture(models.Model):
picture_blob_key = models.TextField()
def picture_url(self):
return images.get_serving_url(self.picture_blob_key)
哪个工作正常。我得到了我想要的结果。但是,每当我尝试同步数据库时,它都会给我一个错误:
$ python manage.py syncdb Traceback(最近一次调用最后):文件“manage.py”,第 14 行,在 execute_manager(settings) 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/ Resources/google_appengine/lib/django_1_3/django/core/management/ init .py”,第 438 行,在 execute_manager utility.execute() 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/资源/google_appengine/lib/django_1_3/django/core/management/ init.py”,第 379 行,在执行 self.fetch_command(subcommand).run_from_argv(self.argv) 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3 /django/core/management/base.py",第 191 行,在 run_from_argv self.execute(*args, ** options.dict) 在执行 self.validate( ) 验证 num_errors = get_validation_errors( s,应用程序)文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/core/management/validation.py”,第 35 行,在 get_validation_errors 中get_app_errors().items() 中的 (app_name, error):文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/db/models/loading.py”,第 146 行,在 get_app_errors self._populate() 文件“/Applications/GoogleAppEngineLauncher. app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/db/models/loading.py”,第 64 行,在 _populate self.load_app(app_name) 文件“/Applications/GoogleAppEngineLauncher .app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/db/models/loading.py”,第 78 行,在 load_app models = import_module('.models', app_name)文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/utils/importlib.py",第 35 行,在 import_module 中导入(名称)文件“/Users/taelimoh/Dropbox/gluwa_test/society/models.py”,第 10 行,从 google.appengine.api 导入图像文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default .bundle/Contents/Resources/google_appengine/google/appengine/api/images/ init .py”,第 48 行,从 google.appengine.api 导入 blobstore 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default .bundle/Contents/Resources/google_appengine/google/appengine/api/blobstore/ init.py”,第 23 行,从 blobstore 导入 * 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/blobstore/blobstore.py”,第 38 行,从 google.appengine.api 导入数据存储文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py”,第 62 行,从 google.appengine.datastore 导入 datastore_query 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_query.py”,第 64 行,在从 google.appengine.datastore 导入 datastore_index 文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_index.py”,第 60 行,从 google.appengine.api 导入验证文件“/Applications/GoogleAppEngineLauncher.app/ Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/validation.py”,第 51 行,在 import yaml ImportError: No module named yaml没有名为 yaml 的模块没有名为 yaml 的模块
因此,现在我必须在使用 syncdb 时将 GAE API 导入注释掉,然后将其重新导入。任何评论将不胜感激。