google-app-engine

How to play(stream instead of download) video file which was stored in GCS using Blobstore API

杀马特。学长 韩版系。学妹 提交于 2020-01-01 19:31:12
问题 How to play(stream instead of download) a video file stored in GCS? The file was stored using Blobstore API in GAE Python? Presently, the video gets downloaded when I use the url, returned by send_blob, in the frontend. I serve the video using: video_url = "/v?video_id="+video_blobkey :: class GCSFileServe(blobstore_handlers.BlobstoreDownloadHandler): def get (self): blob_key = self.request.get('video_id') self.send_blob(blob_key) :: app = webapp2.WSGIApplication([ ('/', MainHandler), ('/v',

Using Golang channels to handle HTTP requests

僤鯓⒐⒋嵵緔 提交于 2020-01-01 19:29:31
问题 I'm trying to build a simple Golang/Appengine app which uses a channel to handle each http request. Reason is I want each request to perform a reasonable large in- memory calculation, and it's important that each request is performed in a thread- safe manner (ie calculations from concurrent requests don't get mixed). Essentially I need a synchronous queue which will only process one request at a time, and channels look like a natural fit. Is it possible to use Go's buffered channel as a

Accessing Cloud Storage from Android

血红的双手。 提交于 2020-01-01 19:27:50
问题 I've been unable to find any concrete documentation on how to use Cloud Storage from an Android application. I did come across this client library from the Google Cloud SDK, however have run into many, many issues and have yet to get it working. I added the following code as recommended in the above link: build.gradle : compile group: 'com.google.cloud', name: 'google-cloud-storage', version: '0.9.3-beta' I then added some simple code, though this isn't really relevant to this question as I

How to set dynamic subdomain cross server or in DNS setting

北城余情 提交于 2020-01-01 19:24:19
问题 I have www.did5.com point to google appengine server I want to have anyname.did5.com point to www.did5.com/anyname And the url in address bar still anyname.did5.com I can't find the way to do by using dns setting (host records) Can anyone do ? Please help.. 回答1: Have the same wish, but had to do HTTP 301 redirect from my domain hosting to an appengine site. It works normally, but it's required to have a working hosting, but not only domain parking. So please try to edit ".htaccess" file,

unable to dowload csv file from FTP server in app engine

江枫思渺然 提交于 2020-01-01 19:22:13
问题 Im trying to read CSV files from ftp server in AppEngine, and I am able to connect to the ftp server. But it returned error when I tried to retrieve files. Here is my code to read the CSV files from server: import ftplib import cStringIO import csv session = ftplib.FTP('myftpserver.com') session.login('username','pwd') session.set_pasv(False) output = cStringIO.StringIO() session.retrbinary('RETR myfile.csv', output.write) csvfile = csv.reader(output.getvalue().splitlines(), delimiter=',')

Google App Engine app.yaml match all PHP files and match all HTML files and serve respectively

ⅰ亾dé卋堺 提交于 2020-01-01 19:17:27
问题 I'm using Google App Engine with PHP. I want all HTML files in the folder Client_Pages to be recognized and served as static files, and all the PHP files in the same folder to be recognized and served as script files. Here is what the app.yaml file looks like: application: myappname version: 1 runtime: php api_version: 1 threadsafe: true handlers: - url: / script: index.php - url: /Client_Pages/*.php script: /Client_Pages/*.php - url: /Client_Pages/*.html static_dir: Client_Pages/*.html I

How do I save web images to App Engine's blobstore?

扶醉桌前 提交于 2020-01-01 19:16:38
问题 I've used this question as a template to solve the same problem, but I'm running into issues when posting. I have these components: HTML form with a textbox for the image URL. This posts to... A handler that takes the posted URL, encodes it, and uses urlfetch to post it again to... A separate file upload handler that does the actual saving. Component #3 works fine by itself if I use a file input. But I don't quite understand how to get urlfetch what it needs from just the image URL. My

Access Google spreadsheet from Google Appengine with service account : working once per hour

柔情痞子 提交于 2020-01-01 19:13:11
问题 I have implemented the python code here below based on the documentation in order to access a spreadsheet accessible through a public link. It works once every hour. If I execute a few seconds after a success, I receive an error : Error opening spreadsheet no element found: line 1, column 0 Assumption: The access token has an expiry date of 1 hour. So the appengine would proceed to a token refresh after an hour, resetting the whole. Question: This code requests a new token for each request.

Django - how to tell if a template fragment is already cached?

半腔热情 提交于 2020-01-01 19:05:42
问题 I am using Django's Template Fragment Caching so in a template.html file {% extends 'base.html' %} {% load cache %} {% block content %} {% cache 500 "myCacheKey" %} My html here... {% endcache %} {% endblock %} This is working fine - I can see it's getting cached and hit but the view is doing something expensive to provide data to this view and thats getting called every time. In views.py def index(request) data = api.getSomeExpensiveData() return render_to_response('template.html', {'data'

Django - how to tell if a template fragment is already cached?

这一生的挚爱 提交于 2020-01-01 19:05:03
问题 I am using Django's Template Fragment Caching so in a template.html file {% extends 'base.html' %} {% load cache %} {% block content %} {% cache 500 "myCacheKey" %} My html here... {% endcache %} {% endblock %} This is working fine - I can see it's getting cached and hit but the view is doing something expensive to provide data to this view and thats getting called every time. In views.py def index(request) data = api.getSomeExpensiveData() return render_to_response('template.html', {'data'