Skip to content

Instantly share code, notes, and snippets.

@edwardfung123
Last active September 27, 2017 16:09
Show Gist options
  • Select an option

  • Save edwardfung123/c052254b46f267e3e103658ed49c9af7 to your computer and use it in GitHub Desktop.

Select an option

Save edwardfung123/c052254b46f267e3e103658ed49c9af7 to your computer and use it in GitHub Desktop.
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
script: main.app
- url: /(.*)
script: main.app
#!/usr/bin/python
# -*- coding: utf-8 -*-
import webapp2
class Handler(webapp2.RequestHandler):
def get(self, num=None):
if num is None:
self.response.write('There is nothing here...')
else:
self.response.write('{}'.format(num))
# see http://webapp2.readthedocs.io/en/latest/guide/routing.html
app = webapp2.WSGIApplication([
webapp2.Route(r'/', Handler),
webapp2.Route(r'/<num:\d+>', Handler),
], debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment