def main(): app = webapp3.WSGIApplication([('/', frontpage.front_page), ('/blog/(\w+)/?', blogpage.blogpage), ('/_edit/(\w+)/?', editpage.edit_page), ('/submit/?', editpage.edit_page), ('/signup/?', signup.signup), ('/login/?', login.login), ('/logout/?', logout.logout)], debug=True) httpserver.serve(app, host='127.0.0.1', port='8080')
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() ndb.get_context().clear_cache() router = Router() router.register('user', APIUserHandler) app = webapp3.WSGIApplication(router.urls) self.testapp = webtest.TestApp(app)
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.testbed.init_app_identity_stub() ndb.get_context().clear_cache() app = webapp3.WSGIApplication([ ('/user/', APIUserHandler) ]) self.testapp = webtest.TestApp(app)
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() ndb.get_context().clear_cache() router = Router() router.register('user', UserApi) app = webapp3.WSGIApplication(router.urls) self.testapp = webtest.TestApp(app) self.entity = User(email='*****@*****.**', first_name='admin', last_name='test', age=28) self.entity.put()
self.response.headers.add_header("X-XSS-Protection", "0") next_ = self.request.get('next') if next_ and 'javascript:' in next_: self.response.out.write('Invalid next path') else: # Route the request to the appropriate template if "signup" in self.request.path: self.response.out.write( render('signup.html', {'next': next_}) ) elif "confirm" in self.request.path: self.response.out.write( render( 'confirm.html', {'next': next_}, ) ) else: self.response.out.write(render('welcome.html', {})) application = webapp.WSGIApplication([('.*', MainPage)], debug=False) if __name__ == '__main__': from paste import httpserver httpserver.serve(application, host='127.0.0.1', port='8080')
template = jinja_environment.get_template( 'templates/confirmation.html') self.response.write(template.render()) app = webapp3.WSGIApplication( [ ('/', MainHandler), ############################# GET ONLY # ('/about', AboutHandler), # ('/privacy', PrivacyHandler), # ('/terms', TermsHandler), # ('/return', ReturnHandler), # ('/careers', CareersHandler), # ('/contact', ContactHandler), ############################## GET & POST # ('/user/([0-9]+))', Redirect), # ('/user/([0-9]+))/cart', CartHandler), # ('/login', LoginHandler) ('/register', RegisterHandler), ('/confirmation', ConfirmationHandler), # ('/user/([0-9]+))/settings', SettingsHandler), # ('/superuser', SuperUserHandler), # ('/error', ErrorPageHandler), ], debug=True) #domain = "gjleong.github.io" #app.config['SERVER_NAME'] = domain def main():