google-app-engine

Unable to handle DeadlineExceededError while using UrlFetch

我们两清 提交于 2020-01-12 02:59:28
问题 I have this basic utility class fetches (possibly) shortened URLs in parallel and returns a dictionary that has final URLs. It uses the wait_any functionality that was described in this blog post. class UrlFetcher(object): @classmethod def fetch_urls(cls,url_list): rpcs = [] for url in url_list: rpc = urlfetch.create_rpc(deadline=5.0) urlfetch.make_fetch_call(rpc, url,method = urlfetch.HEAD) rpcs.append(rpc) result = {} while len(rpcs) > 0: rpc = apiproxy_stub_map.UserRPC.wait_any(rpcs) rpcs

How to make Django template engine to render in memory templates?

折月煮酒 提交于 2020-01-12 02:58:54
问题 I am storing my templates in the database and I don't have any path to provide for the template.render method. Is there any exposed method which accepts the template as a string? Is there any workaround? 回答1: Instantiate Template with the string to use as a template. 回答2: Based on the the docs for using the template system: from django.template import Template, Context t = Template("My name is {{ my_name }}.") c = Context({"my_name": "Adrian"}) t.render(c) 回答3: In Django < 1.8: from django

Performance issues with App Engine memcache / ndb.get_multi

♀尐吖头ヾ 提交于 2020-01-12 01:47:06
问题 I'm seeing very poor performance when fetching multiple keys from Memcache using ndb.get_multi() in App Engine (Python). I am fetching ~500 small objects, all of which are in memcache. If I do this using ndb.get_multi(keys) , it takes 1500ms or more. Here is typical output from App Stats: and As you can see, all the data is served from memcache. Most of the time is reported as being outside of RPC calls. However, my code is about as minimal as you can get, so if the time is spent on CPU it

How do dynamic backends start in Google App Engine

笑着哭i 提交于 2020-01-12 01:42:26
问题 Can we start a dynamic backend programatically? mean while when a backend is starting how can i handle the request by falling back on the application(i mean app.appspot.com). When i stop a backend manually in admin console, and send a request to it, its not starting "dynamically" 回答1: Dynamic backends come into existence when they receive a request, and are turned down when idle; they are ideal for work that is intermittent or driven by user activity. Resident backends run continuously,

What's the best way to back up data on Google App Engine?

ぐ巨炮叔叔 提交于 2020-01-11 15:30:31
问题 Google itself provides two solutions. http://code.google.com/appengine/docs/python/tools/uploadingdata.html One of these is new and experimental and requires you to run a separate command (and separately enter your username and password) for each kind of data you want to back up. The other requires you to twice write out information on the structure of all the kinds of your data, information that is already implicit in your models file. (We've got 25 different kinds of data so I'm sensitive

The API package 'remote_socket' or call 'Resolve()' was not found - GAE Java

北慕城南 提交于 2020-01-11 13:54:11
问题 I'm trying to call a Google Service in a GAE application hosted in GAE cloud: private String doPost(String URL) throws ClientProtocolException, IOException { // Params: List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("accountType", "HOSTED_OR_GOOGLE")); params.add(new BasicNameValuePair("Email", _DEFAULT_USER)); params.add(new BasicNameValuePair("Passwd", _DEFAULT_PASS)); params.add(new BasicNameValuePair("service", "ah")); // Call HttpClient

FetchOptions withLimit() does not reduce query execution time (Google App Engine)

不羁岁月 提交于 2020-01-11 13:21:07
问题 Problem Running a datastore query with or without FetchOptions.Builder.withLimit(100) takes the same execution time! Why is that? Isn't the limit method intended to reduce the time to retrieve results!? Test setup I am locally testing the execution time of some datastore queries with Google's App Engine. I am using the Google Cloud SDK Standard Environment with the App Engine SDK 1.9.59. For the test, I created an example entity with 5 indexed properties and 5 unindexed properties. I filled

How to Force SSL on Google App Engine Flexible Environment

℡╲_俬逩灬. 提交于 2020-01-11 12:26:28
问题 Is there documentation showing how to force HTTPS on Google App Engine - Flexible PHP? I tried placing secure on app.yaml and I had no luck. I also tried in the nginx-app.conf placing this but no luck. I also tried set $test ""; if ($http_x_forwarded_proto = 'http') { set $test "http"; } if ($test = 'http-non-cron') { return 301 https://$host$request_uri; } Other Option I tried <?php header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload"); exit(); ?> but no luck. 回答1

Google App Engine Standard env - not found controller method - Spring Boot app

你离开我真会死。 提交于 2020-01-11 12:23:30
问题 I was trying to deploy Spring Boot application on Google App Engine (standard environment). At first I cloned example app from this nice tutorial https://springframework.guru/spring-boot-web-application-part-4-spring-mvc/ For example I called http://localhost:8080/products and template with data was displayed. So everything ran without problems, I was able to call all controller methods locally. Then I decided as experiment to deploy it on GAE. I adjusted pom.xml according to instructions

Why PostgreSQL adapter psycopg2 fail in Google App Engine dev_appserver.py?

坚强是说给别人听的谎言 提交于 2020-01-11 11:58:54
问题 I want connect my app that are in GAE with ElephantDB. I want use the lib psycopg2 and I found a problem. I installed the lib in local to test it and work perfectly and then I installed the lib in lib folder on my app as I have done many times with other libs. This time with pip install -t appname/lib/ psycopg2 So, dev server dectect the lib, but say me that : ImportError: No module named psycopg2._psycopg At first I thought that the problem was python version that dev_server was executing,