0

私の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)

これはうまくいきます。私は望む結果を得ています。ただし、syncdb を実行しようとすると、エラーが発生します。

$ python manage.py syncdb トレースバック (最新の呼び出しが最後): ファイル "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/ Resources/google_appengine/lib/django_1_3/django/core/management/ init.py"、379 行目、execute 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) ファイル "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/core/management/base.py"、219 行目、execute self.validate( ) ファイル "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/core/management/base.py"、249 行目、validate num_errors = get_validation_errors( s, app) ファイル "/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 の(app_name, error) in get_app_errors().items(): ファイル "/Applications/GoogleAppEngineLauncher.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 モデル内 = 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 内import (name) File "/Users/taelimoh/Dropbox/gluwa_test/society/models.py", line 10, from from google.appengine.api import images File "/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 行目、ブロブストアからインポート * ファイル "/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、インポート yaml の ImportError: No module named yamlyaml という名前のモジュールがありませんyaml という名前のモジュールがありません

そのため、今のところ、syncdb を使用しているときに GAE API のインポートをコメントアウトしてから、元に戻す必要があります。コメントをお待ちしております。

4

1 に答える 1

0

あなたが得ているエラーは、import yaml失敗したためです。このライブラリは GAE にバンドルされており、ツールを起動するたびに、それを見つけるために sys パスを修正します。

できることは、yaml パッケージを手動でインストールすることです。

于 2012-08-14T17:08:25.363 に答える