I've been playing with Flickr API with a GAE webapp.
To maximize the performance, I didn't use some framework to build it. Basic APIs such as http connections are used to handle the communication.
The small app has been auto-tested thousands of times on local GAE run-time, and it's working fine totally.
And no GAE datastore is used for this app (hence no datastore indexes need to be generated); I expect the app to work fine after a successful deployment.
However I faced the issue that 45% of the http request gave the same error message, complaining the invalid format of the data stream (returned from Flickr REST service). From the debug message trace, it turned out almost half of the requests, which are supposed to get data in JSON format (by setting JSON format as one of the query parameters), got routed to flickr API community guidelines page, resulting in that irrelevant data in html format was returned, although every time the HTTP GET was requested towards the same Flickr url.
I did some googling, and was not able to find out why this happened. I was thinking probably Flickr partially blocked/redirected requests from google (GAE) because it was a Yahoo company. Not sure about that.
On the second day, I just tested the same app again. It works totally fine again, just as what I experienced with the local GAE run-time. It seems there's always a delay before a newly deployed GAE app to behave properly.
This is a Java app; I'll check if Python app behaves similarly.
Showing posts with label GAE. Show all posts
Showing posts with label GAE. Show all posts
Thursday, November 07, 2013
Friday, October 25, 2013
Variable placeholder conflict between AngularJs and Jinja2 template
It's quite common that in web page templates (diango or jinja2 templates) brackets "{{}}" are used as placeholders for template variables.
When people want to use angularjs in those template files, angularjs might not work properly because it also uses "{{}}" to bind data model.
A workaround for this is to redefine the templates; an example for Jinja2 template is as follows:
JINJA_ENVIRONMENT=jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], variable_start_string='((', variable_end_string='))', autoescape=True)After this step is done, in the template files, "(())" refers to template variables, and "{{}}" refers to AngularJs data model.
Subscribe to:
Posts (Atom)