Routing in Google AppEngine using Webapp2.
Hi,
There are may things that are hidden on the google docs.
1. Request handler for routing.
in the
Here is the link to this and more
about the routing. man
http://webapp-improved.appspot.com/guide/routing.html#simple-routes link
There are more
This is about the domain routing.>>>>
import webapp2
===== to get the url and query_arguments
There are may things that are hidden on the google docs.
1. Request handler for routing.
in the
class HomeHandler(webapp2.RequestHandler):])
def get(self):
self.response.write('This is the HomeHandler.')
class ProductListHandler(webapp2.RequestHandler):
def get(self):
self.response.write('This is the ProductListHandler.')
class ProductHandler(webapp2.RequestHandler):
def get(self, product_id):
self.response.write('This is the ProductHandler. '
'The product id is %s' % product_id)
app = webapp2.WSGIApplication([
(r'/', HomeHandler),
(r'/products', ProductListHandler),
(r'/products/(\d+)', ProductHandler),
Here is the link to this and more
about the routing. man
http://webapp-improved.appspot.com/guide/routing.html#simple-routes link
There are more
This is about the domain routing.>>>>
import webapp2
from webapp2_extras import routes
app = webapp2.WSGIApplication([
routes.DomainRoute('<subdomain>.app-id.appspot.com', [
webapp2.Route('/', handler=SubdomainHomeHandler, name='subdomain-home'),
]),
webapp2.Route('/', handler=HomeHandler, name='home'),
])
===== to get the url and query_arguments
Try this:
self.request.url
Also, if you just need the querystring, this will work: self.request.query_string
And, lastly, if you know the querystring variable that you're looking for, you can do this: self.request.get("name-of-querystring-variable")
or use can use this
query_sting = self.request.GET
And more to learn here.