Hi, Lets say i have a template which contains one button.. But when i click on that button it should take me to (say) google.com So i dont have the template for that site.. so lets say my view is @app.route("/") def hello(): #return ???what??? Thanks -- Mohit "When you want success as badly as you want the air, then you will get it. There is no other secret of success." -Socrates
You can return straight html if you really want to. @app.route("/") def hello(): return "<html><body><a href="http://www.google.com >Google</a></body></html> --- Michael Davis Software Engineering - Iowa State University WebFilings Software Engineer Intern IASG Treasurer On Wed, Mar 6, 2013 at 1:57 PM, Mohit Singh <mohit1007@gmail.com> wrote: > Hi, > > Lets say i have a template which contains one button.. > > But when i click on that button it should take me to (say) google.com > So i dont have the template for that site.. > so lets say my view is > @app.route("/") > def hello(): > #return ???what??? > > Thanks > > -- > Mohit > > "When you want success as badly as you want the air, then you will get it. > There is no other secret of success." > -Socrates >
Great thanks :) On Wed, Mar 6, 2013 at 12:06 PM, Michael Davis <mike.philip.davis@gmail.com>wrote: > You can return straight html if you really want to. > > > @app.route("/") > def hello(): > return "<html><body><a href="http://www.google.com > >Google</a></body></html> > > --- > Michael Davis > Software Engineering - Iowa State University > WebFilings Software Engineer Intern > IASG Treasurer > > > On Wed, Mar 6, 2013 at 1:57 PM, Mohit Singh <mohit1007@gmail.com> wrote: > >> Hi, >> >> Lets say i have a template which contains one button.. >> >> But when i click on that button it should take me to (say) google.com >> So i dont have the template for that site.. >> so lets say my view is >> @app.route("/") >> def hello(): >> #return ???what??? >> >> Thanks >> >> -- >> Mohit >> >> "When you want success as badly as you want the air, then you will get >> it. There is no other secret of success." >> -Socrates >> > > -- Mohit "When you want success as badly as you want the air, then you will get it. There is no other secret of success." -Socrates
And if you want to be really silly, you can return HTML with a meta redirect tag. Others have given better suggestions, but for the sake of completeness... <-- redirect user to Google after five seconds --> <META http-equiv="refresh" content="5;URL=http://google.com">
On Wed, Mar 6, 2013 at 11:57 AM, Mohit Singh <mohit1007@gmail.com> wrote: > Hi, > > Lets say i have a template which contains one button.. > > But when i click on that button it should take me to (say) google.com > So i dont have the template for that site.. > so lets say my view is > @app.route("/") > def hello(): > #return ???what??? > Why do you need to use flask for that? It sounds like you could just use a link: <a href="http://www.google.com">Google</a> If you really want to use flask, look into flask.redirect.