google-app-engine-python

Weird query comparison of GeoPt in google ndb

匆匆过客 提交于 2019-12-11 02:12:40
问题 I try to query entities in datastore with GeoProperty, but the strange thing is it will compare GeoProperty's first argument, lat. If lat is compared, then it will directly return the result. The only exception is latitude is equal, then the longitude is then compared. For example, GeoPt(11, 10) < GeoPt(9, 20) will return False because former latitude is not smaller than latter. However, latter is bigger than former. SO this kind of comparison bother me when I want to query the entities in

Running locally with GAE Python second generation

强颜欢笑 提交于 2019-12-11 01:27:25
问题 I've been using GAE/P 1st gen for many years and am making the jump to my first GAE/P 2nd gen project. I'm trying to run it locally like I did with dev_appserver.py for 1st gen apps, but the docs are very confusing in this respect. I can run Flask on its own ( python main.py ) but static files don't work (since Flask knows nothing about app.yaml ) and the datastore won't work either. The GAE docs say that dev_appserver.py should work for 2nd gen (except on Windows but I'm on Mac) but when I

How is memory garbage collected in app engine (python) when iterating over db results

邮差的信 提交于 2019-12-10 19:47:25
问题 I have some code that iterates over DB entities, and runs in a task - see below. On app engine I'm getting Exceeded soft private memory limit error, and indeed checking memory_usage().current() confirms the problem. See below for output from logging statement. It seems that every time a batch of foos is fetched the memory goes up. My question is: why is the memory not being garbage collected? I would expect, that in each iteration of of the loops (the while loop, and the for loop,

Google App Engine Launcher Python Path

一曲冷凌霜 提交于 2019-12-10 14:09:08
问题 When I install the Google App Engine SDK and run the launcher, it asks me to configure the python location: And when I open Preferences , it asks for a path to a python executable: Which path should I insert and what is the difference: C:\Python27\python.exe C:\Python27\pythonw.exe 回答1: Looks like Google App Engine couldn't find your python installation. It looks for Python by checking the PATH environment variable, so it's best to use it. The short answer is use C:\Python27\pythonw.exe . I

Google KMS on AppEngine/Python & Development AppServer

女生的网名这么多〃 提交于 2019-12-09 23:47:48
问题 It's not clear from the documentation how one might wield Google Key Management System (KMS) on Google App Engine Standard, particularly when developing locally using the development server. It would appear as reasonably straightforward as: Installing google-api-python-client in a Python virtual env (and adding the virtualenv path with google.appengine.ext.vendor in appengine_config.py ) importing googleapiclient.discovery getting the application identity with google.appengine.api.app

Increase time to run code for Google flexible app engine delaying DeadlineExceededError

…衆ロ難τιáo~ 提交于 2019-12-09 06:25:32
问题 I have a single function running on Google App Engine Flexible as part of an API call. The structure is something like this import externalmod ... ... @app.route('/calc_here') def calc: answer = externalmod.Method() return answer The function externalmod is a complicated algorithm (not datastore, not urlfetch, just pure python), which works for every possible case on the desktop but for some input cases on the app engine, when the endpoint is called it gives the following error { "code": 13,

TransactionFailedError on GAE when no transaction

跟風遠走 提交于 2019-12-09 02:53:34
I got this error: TransactionFailedError: too much contention on these datastore entities. please try again. Even though I'm not doing any transactions. The line of my code that causes the error is ndb.put_multi(entity_list) # entity_list is a list of 100 entities This error doesn't happen often so it isn't a big deal, but I'm curious why I get this error. Any ideas? Here is most of the traceback: Traceback (most recent call last): ... File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/ext/deferred/deferred.py", line 318, in post self.run_from_request()

How to add more scopes in GoogleCloud Endpoints

牧云@^-^@ 提交于 2019-12-08 09:21:30
问题 So, I want to use Plus.me or lets say userinfo.profile scope with Google Cloud Endpoints with python as a backend. Server Configuration: @endpoints.api( name='sidebar', version='v1',# auth=AUTH_CONFIG, allowed_client_ids=[WEB_CLIENT_ID, ANDROID_CLIENT_ID, endpoints.API_EXPLORER_CLIENT_ID], audiences=[ANDROID_AUDIENCE], scopes=[endpoints.EMAIL_SCOPE, "https://www.googleapis.com/auth/plus.me"]) class Sidebar(remote.Service): Does anybody have an idea how to send the appropriate scope from

What is the best practice to populate a StructuredProperty through the ndb.Model constructor?

℡╲_俬逩灬. 提交于 2019-12-08 08:12:28
问题 I looked into the ndb GitHub sample code, but I couldn't find any example which shows on how to create a ndb entity with a constructor that contains a StructuredProperty . Here is the GitHub example. What if I want to initialize a Contact entity with a list of phone numbers and this list of phone number is not a list of PhoneNumber objects. Instead it is a list of Python dictionaries. So, given the following Model classes: class PhoneNumber(ndb.Model): """A model representing a phone number."

TransactionFailedError on GAE when no transaction

北城以北 提交于 2019-12-08 05:55:27
问题 I got this error: TransactionFailedError: too much contention on these datastore entities. please try again. Even though I'm not doing any transactions. The line of my code that causes the error is ndb.put_multi(entity_list) # entity_list is a list of 100 entities This error doesn't happen often so it isn't a big deal, but I'm curious why I get this error. Any ideas? Here is most of the traceback: Traceback (most recent call last): ... File "/base/data/home/runtimes/python27_experiment