0

在我的model.py中,我導入圖像以生成圖片的url,如下所示。在model.py中導入GAE API的錯誤

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 Traceback(最近調用最後一次):文件「manage.py」,行14,在execute_manager(設置)文件「/應用程序/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「,in line 379,in 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行.validate()文件「/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/core/management/base.py」,第249行,用於驗證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_app_errors()中的(app_name,error)的get_validation_errors中的項目():文件「/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_3/django/db/ models/loading.py「,第146行,ge t_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 import(name)文件「/Users/taelimoh/Dropbox/gluwa_test/society/models.py」,第10行,從google.appengine.api導入圖像文件「/Applications/GoogleAppEngineLauncher.app /Contents/Resources/GoogleAppEngine-default.bundle/Contents/Reso urces/google_appengine/google/appengine/api/images/init .py「,第48行,從google.appengine.api導入blobstore文件」/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/目錄/資源/ google_appengine/google/appengine/api/blobstore/init .py「,第23行,來自blobstore import * File」/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/資源/ google_appengine/google/appengine/api/blobstore/blobstore.py「,第38行,從google.appengine.api導入數據存儲文件」/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/資源/ google_appengine/google/appengine/api/datastore.py「,第62行,從google.appengine.datastore導入datastore_query文件」/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppE ngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_query.py「,第64行,來自google.appengine.datastore import datastore_index File」/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模塊命名yaml

所以,現在我不得不註釋GAE API導入時,我使用syncdb,然後將其帶回。任何意見將不勝感激。

回答

0

您得到的錯誤是因爲import yaml失敗。這個庫與GAE捆綁在一起,無論何時啓動一個工具,它都會修復sys路徑以便找到它。

你可以做的是手動安裝yaml包。

+0

這對我來說就像一個魅力。謝謝! – taelimoh 2012-08-14 20:27:41