mercredi 1 juillet 2015

Redirect in python script

I am new to web development. I have written a code for a sign-up page asking for information like username, password and email. After the user gives correct input, the page is redirected to

'/welcome?username=name'

I am using the self.redirect. By using the methd redirect, I am getting the the new URL as '/welcome'. How will I include the query parameter? I also want the user_name to be displayed to the redirected page like :

Welcome name

How will I do this? This is the class I have written to handle '/welcome'

class welcomeHandler(webapp2.RequestHandler):
    def get(self):
        self.response.out.write("Welcome")

app = webapp2.WSGIApplication([
    ('/', MainHandler),('/welcome',welcomeHandler)], debug=True)




Aucun commentaire:

Enregistrer un commentaire