google-app-engine

How to convert django ManyToManyField into Django-nonrel Field?

回眸只為那壹抹淺笑 提交于 2020-01-14 02:16:07
问题 I build an app in django, but since I found out that google app engine doesn't support Django out of the box (free,cloud sql can't be used for free right?). I decided to move to Django-nonrel, so there are few datebase Field that need converting, and I don't know how: class Cate(models.Model): name = models.CharField(max_length = 100) description = models.TextField() create_by = models.ForeignKey(User) create_date = models.DateTimeField('cate created date') def __unicode__(self): return self

Querying Geopt with Objectify

别说谁变了你拦得住时间么 提交于 2020-01-13 19:21:08
问题 I am having the hardest time querying a GeoPt field with Objectify. I made sure there's an @Index annotation about the GeoPt field. However, the statement below doesn't seem to work ofy().load() .type(GeoStat.class) .filter("geoPt.latitude >=", neLat) .limit(10); Is querying GeoPt field possible in Objectify? 回答1: The datastore does not support querying a GeoPt in this way. If you wish to query on latitude, index it separately (possibly writing to a private field in an @OnSave method).

InvocationTargetException storing files with appengine-gcs-client-0.5 dev_appserver

為{幸葍}努か 提交于 2020-01-13 19:16:05
问题 I'm using appengine-gcs-client-0.5 and seeing InvocationTargetExceptions in my dev_appserver when calling GcsService.createOrReplace and GcsOutputChannel.close. It seems like the call to storeBlob does not have the appropriate permission, as the appserver gets an AccessControlException in com.google.appengine.api.blobstore.dev.FileBlobStorage.storeBlob: java.security.AccessControlException: access denied ("java.io.FilePermission" "/tmp/1440435923000-0/encoded_gs_key:<some key>" "write") What

Windows local appengine usage: oauth2client ImportError

痞子三分冷 提交于 2020-01-13 19:14:13
问题 I m working with App Engine Standard, developing a Python backend service and, at some point, I told myself: "Hey why don't you try out and run the server locally while using the remote Datastore" I can run this code locally but I couldn't figure out why the remote_api_stub throws the error : " File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 1003, in ConfigureRemoteApiForOAuth 'oauth2client

Windows local appengine usage: oauth2client ImportError

混江龙づ霸主 提交于 2020-01-13 19:14:10
问题 I m working with App Engine Standard, developing a Python backend service and, at some point, I told myself: "Hey why don't you try out and run the server locally while using the remote Datastore" I can run this code locally but I couldn't figure out why the remote_api_stub throws the error : " File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 1003, in ConfigureRemoteApiForOAuth 'oauth2client

Set operations in Appengine datastore

倾然丶 夕夏残阳落幕 提交于 2020-01-13 18:37:48
问题 I assume there's no good way to do so, but if you had to, how would you implement set operations on Appengine's datastore? For example given two collections of integers, how would you store them in the datastore to get a good performance for intersect and except (all those items in A that are not in B) operations? 回答1: There aren't any built in set operations in the datastore API. I see you having two options: For smallish sets (hundreds of items) You might get away with doing keys-only

How to simulate file upload to blobstore using GAE dev server testbed for python

血红的双手。 提交于 2020-01-13 16:47:26
问题 Id like to write some unit tests that among other thing will need to read a blobstore file How to write a unit test setUp that puts some file in testbed blobstore so it will availabe for read this way: blob_info = BlobInfo(blob_key) reader = BlobReader(blob_info) reader.readline() EDIT: I do not look for a way to test files API, I want to put some arbitrary data in the testbed blobstore storage dusring the test case setUp phase, so I can run tests against this data. 回答1: You can add the

Acceptance testing preloading of data into GAE dev server datastore

痞子三分冷 提交于 2020-01-13 11:32:36
问题 In my application I have a set of of DAOs which I inject into my application layer. For an acceptance test I'm writing, I want to preload the dev_server datastore with data, so I use the same Spring config in my JUnit test (using the @ContextConfiguration annotation) to inject an instance of the relevant DAO into my test. When I actually go to store some data eg: dao.add(entity) I get the dreaded "No API environment is registered for this thread." Caused by: java.lang.NullPointerException: No

Asynchronous fetch request with Google App Engine

妖精的绣舞 提交于 2020-01-13 11:02:57
问题 I'm reading the documentation for asynchronous fetch requests in GAE. Python isn't my first language, so I'm having trouble finding out what would be best for my case. I don't really need or care about the response for the request, I just need it to send the request and forget about it and move on to other tasks. So I tried code like in the documentation: from google.appengine.api import urlfetch rpc = urlfetch.create_rpc() urlfetch.make_fetch_call(rpc, "http://www.google.com/") # ... do

Google App Engine. How to make synchronized actions using memcache or datastore?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-13 11:00:07
问题 My main goal is to be able to have some synchronized method that shouldn't be accessed by other threads until it is finished. If I had usual VM - I would mark this method as synchronized. But in GAE I have multiple instances. All posts that I read about this say that I should use memcache or datastore. But how exactly ? 回答1: Usually the answer is redesign the function so it doesn't need to be globally synchronized. Even if you manage to synchronize it, it's a single bottleneck. You're