google-app-engine

App Engine and Cloud Storage I generate thumbnail image has larger file size than original image

。_饼干妹妹 提交于 2020-01-04 11:02:06
问题 My function work for me but the thumbnail image file size is larger than original file size. Original File: 30Kb Thumbnail File: 50Kb My Function public static void thumbnailImage(String filename, int width, int height) throws IOException{ GcsService gcsService = GcsServiceFactory.createGcsService(new RetryParams.Builder() .initialRetryDelayMillis(10) .retryMaxAttempts(10) .totalRetryPeriodMillis(15000) .build()); AppIdentityService appIdentity = AppIdentityServiceFactory

How to add date and time under each post in guestbook in google app engine

柔情痞子 提交于 2020-01-04 09:36:31
问题 here is the code: import cgi import datetime import wsgiref.handlers from google.appengine.ext import db from google.appengine.api import users from google.appengine.ext import webapp class Greeting(db.Model): author = db.UserProperty() content = db.StringProperty(multiline=True) date = db.DateTimeProperty(auto_now_add=True) class MainPage(webapp.RequestHandler): def get(self): self.response.out.write('<html><body>') greetings = db.GqlQuery("SELECT * FROM Greeting ORDER BY date DESC LIMIT 10"

Cloud Tasks API for python2.7 google app engine

本小妞迷上赌 提交于 2020-01-04 09:03:26
问题 I have created a project under Google App Engine Python 2.7. I have created some tasks using queue.yaml and deployed with the glcoud command. When I go to the Google App Engine console under section "taskqueues", it redirects to the Cloud Tasks page. I can see my App Engine queues are listed under Cloud Tasks. I have still not enabled 'Cloud Tasks API' service but when I launch background task which service is handling the queue? Then if I want to use Cloud Tasks service with App Engine

How can I test the validity of a ReferenceProperty in Appengine?

时间秒杀一切 提交于 2020-01-04 06:22:30
问题 I am currently testing a small application I have written. I have not been sufficiently careful in ensuring the data in my datastore is consistent and now I have an issue that I have some records referencing objects which no longer exist. More specifially, I have some objects which have ReferenceProperty's which have been assigned values; the objects referred to have been deleted but the reference remains. I would like to add some checks to my code to ensure that referenced objects exist and

Does the GAE Search API support partial or prefix searches?

妖精的绣舞 提交于 2020-01-04 06:14:59
问题 The Google App Engine Search API docs are a little light on the subject of partial or prefix searches. I understand that stemming is supported, but that's not quite what I want. There are several other SO questions around this topic here, here and here. It seems like partial-text search has been requested a number of times over several years. Am I missing something in the GAE docs or is this still not supported? Thanks for the sanity check! 回答1: This (more recent) 'acknowledged' issue would

Trouble locating static audio file on Google App Engine

谁说胖子不能爱 提交于 2020-01-04 06:10:51
问题 I have a project directory and a sub directory set up as such: /proj_dir /proj_dir/audio app.yaml: handlers: - url: /.* script: main.py - url: /audio static_dir: audio main.py is a simple Python program that, on a GET request, outputs the "index.html" file also in the proj_dir directory. The index.html file contains some javascript code that plays the audio file. The problem is that index.html plays the audio file without issue when run locally. Once deployed, however, I get a 404 when trying

How do I pass url parameter to form value?

本秂侑毒 提交于 2020-01-04 05:55:32
问题 The form has this hidden field <input type="hidden" name="dir_type" value="tshirt"> url parameters are /dir?type=tshirt /dir?type=books /dir?type=posters and so on. Now I hard coded value="tshirts" but how do I get parameter for the relevant page? I found several pages like this dealing with similar topics but I did not understand how this is done. Thanks for your help. UPDATE The answer by systempuntoout works perfectly but I decided to solve the problem without using templates. And for

Connecting to PostgreSQL in java app engine

落花浮王杯 提交于 2020-01-04 05:54:26
问题 I'm trying to connect to PostgreSQL server from java app engine. On my local machine code works perfectly, but when I deploy code to appengine, I get this exception: Uncaught exception from servlet java.lang.NullPointerException at com.google.appengine.runtime.Request.process-3a02a4d7b73299fa(Request.java) at java.util.Hashtable.put(Hashtable.java:432) at java.util.Properties.setProperty(Properties.java:161) at org.postgresql.Driver.loadDefaultProperties(Driver.java:121) at org.postgresql

“=” symbols in GAE TextProperty

青春壹個敷衍的年華 提交于 2020-01-04 05:40:08
问题 I'm getting strange additional symbols (=) in text property when adding text there via POST. For example: The team is back with an unstoppable fury as they are being chased by the p= olice, Alonzo and Yuuma. Vinnie, Shorty and Kiro=92s skills will be put to = the test. There shouldn't be any of = symbols in that text. My co de is: class FileUploadHandler(blobstore_handlers.BlobstoreUploadHandler): def post(self): game_file = self.get_uploads()[1] screen_file = self.get_uploads()[0] if not

Getting The Most Recent Data Item - Google App Engine - Python

筅森魡賤 提交于 2020-01-04 05:36:14
问题 I need to retrieve the most recent item added to a collection. Here is how I'm doing it: class Box(db.Model): ID = db.IntegerProperty() class Item(db.Model): box = db.ReferenceProperty(Action, collection_name='items') date = db.DateTimeProperty(auto_now_add=True) #get most recent item lastItem = box.items.order('-date')[0] Is this an expensive way to do it? Is there a better way? 回答1: If you are going to iterate over a list of boxes, that is a very bad way to do it. You will run an additional