webapp2

Flask vs webapp2 for Google App Engine

Deadly 提交于 2019-11-27 10:14:11
I'm starting new Google App Engine application and currently considering two frameworks: Flask and webapp2 . I'm rather satisfied with built-in webapp framework that I've used for my previous App Engine application, so I think webapp2 will be even better and I won't have any problems with it. However, there are a lot of good reviews of Flask, I really like its approach and all the things that I've read so far in the documentation and I want to try it out. But I'm a bit concerned about limitations that I can face down the road with Flask. So, the question is - do you know any problems,

XHR responseText is empty string

岁酱吖の 提交于 2019-11-27 08:11:53
问题 Html Page: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>xhr</title> </head> <body> <script> var xhr_test = new XMLHttpRequest(); xhr_test.open("GET","xhrtest",true); xhr_test.send(); alert(xhr_test.responseText); </script> </body> </html> The main.py file: import webapp2 from handlers import cookies,pages application = webapp2.WSGIApplication([ ('/xhr',pages.XHR), ('/xhrtest', cookies.XHRTest) ], debug=True) The Request handlers: class XHRTest(webapp2.RequestHandler):

GAE webapp2 session: the correct process of creating and checking sessions

谁都会走 提交于 2019-11-27 04:14:39
问题 I tried to implement GAE's webapp2 session, but there seems very little documentation about it. According to http://webapp-improved.appspot.com/api/webapp2_extras/sessions.html, my steps are as follows: 1.Configure and add config to the main application: config = {} config['webapp2_extras.sessions'] = { 'secret_key': 'my_secret_key', } app = webapp2.WSGIApplication([...], config=config) 2.Create session in the login handler # Delete existent session --> not mention in the tutorial # member is

What's a good approach to managing the db connection in a Google Cloud SQL (GAE) Python app?

蹲街弑〆低调 提交于 2019-11-27 02:48:36
问题 I'm just learning Google App Engine and am trying to figure out a good approach to managing my database connection to a Google Cloud SQL instance (if you haven't used GC-SQL, basically, it's MySQL in the cloud, with a few limitations). I'm using the python (2.7) GAE environment with the webapp2 framework for handling requests. I know the FAQ says that it's recommended that a new connection to the DB be made with each request, but I don't know what the recommended way of closing the connection

Webapp2 for Authentication and Login

一世执手 提交于 2019-11-27 00:17:51
问题 I would like to roll my own login system for my python Google App Engine application (rather than using Google's users api). I am using webapp2, and I noticed that there is a webapp2_extras.auth module and an incomplete auth tutorial. Does anyone know how I can use this API to create: User Registration (take an email and password, and perhaps verify email) User Login with email and password Once I have the email and password, where do I store it? In the AuthStore? And how do I authenticate

How to properly output JSON with app engine Python webapp2?

被刻印的时光 ゝ 提交于 2019-11-26 19:23:54
问题 Right now I am currently just doing this: self.response.headers['Content-Type'] = 'application/json' self.response.out.write('{"success": "some var", "payload": "some var"}') Is there a better way to do it using some library? 回答1: Yes, you should use the json library that is supported in Python 2.7: import json self.response.headers['Content-Type'] = 'application/json' obj = { 'success': 'some var', 'payload': 'some var', } self.response.out.write(json.dumps(obj)) 回答2: webapp2 has a handy

Flask vs webapp2 for Google App Engine

谁都会走 提交于 2019-11-26 15:08:47
问题 I'm starting new Google App Engine application and currently considering two frameworks: Flask and webapp2. I'm rather satisfied with built-in webapp framework that I've used for my previous App Engine application, so I think webapp2 will be even better and I won't have any problems with it. However, there are a lot of good reviews of Flask, I really like its approach and all the things that I've read so far in the documentation and I want to try it out. But I'm a bit concerned about