I'm using Django along with appengine. When I try to save a record, I'm getting the error "app_id must not be empty". The application name has been set in app.yaml. I also added os.environ['APPLICATION_ID'] = 'test' in main.py. However, I continue to get the same error.
A:
I haven't seen your error before. Note that you can't use the native Django database functions without using the "Django Helper" application:
http://code.google.com/appengine/articles/appengine_helper_for_django.html
You do not need to use Django Helper if you are only using parts of Django (but using native App Engine Models for storage):
http://code.google.com/appengine/docs/python/datastore/overview.html
mckoss
2009-09-26 16:24:05
This error occured when I was migrating from appengine helper to appengine patch.
Sriram
2009-10-01 12:46:11
+1
A:
When I try to save a record, I'm getting the error "app_id must not be empty".
When I'm using appengine as "standalone" e.g. (unit testing) in order to fix the "app_id must not be empty" error I always execute:
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)
just before my code that use the Google App Engine datastore.
If you run the appserver locally you shouldn't need this code because all the magic is made by the framework reading the app.yaml file
Filippo
2010-02-09 16:24:18