2009-09-02 17 views
1

我使用Django以及appengine。當我嘗試保存記錄時,出現錯誤 「app_id不能爲空」。應用程序名稱已在app.yaml中設置。我還在main.py中添加了 os.environ ['APPLICATION_ID'] ='test'。但是,我仍然遇到同樣的錯誤。如何在Appengine中設置應用程序ID?

回答

0

我以前沒見過你的錯誤。請注意,你不能沒有使用「Django的助手」應用程序中使用本地Django的數據庫功能:

http://code.google.com/appengine/articles/appengine_helper_for_django.html 

你並不需要,如果你只使用Django的部分(但使用原生App Engine的使用Django助手用於存儲模型):

http://code.google.com/appengine/docs/python/datastore/overview.html 
+0

這個錯誤,當我從AppEngine上的輔助遷移到AppEngine上補丁發生讓你不應該需要這個代碼。 – Sriram 2009-10-01 12:46:11

1

當我嘗試保存記錄,我得到錯誤「APP_ID不能爲空」。

當我將appengine用作「獨立」軟件時,例如爲了解決「APP_ID不能爲空」(單元測試)的錯誤,我一直執行:

app_id = 'XXXXXX' 
os.environ['APPLICATION_ID'] = app_id 
datastore_path = os.path.join(tempfile.gettempdir(),'dev_appserver.datastore') 
history_path = os.path.join(tempfile.gettempdir(),'dev_appserver.datastore.history') 
require_indexes = False 
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap() 
datastore = datastore_file_stub.DatastoreFileStub(app_id, datastore_path, history_path, require_indexes=require_indexes) 
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore) 

只是我的代碼,使用谷歌App Engine數據存儲之前。

如果您在本地運行應用程序服務器,因爲所有的魔法是由框架讀取app.yaml文件

相關問題