Redirect to a specific URL in a Google app

I work in Google App Engine, I want to redirect the browser to a specific URL that is retrieved from the data store.

The saved URL model is similar to

class WebReference(db.Model): website = db.StringProperty() webreferecnce=db.StringProperty() 

My code

 query = db.GqlQuery("SELECT * FROM WebReference where webreferecnce = '10'") results = query.fetch(1) for r in results: self.redirect(r.website) 

I want to redirect the URL to a website that has web number 10. This is done on the local host, but not after loading. how can i achieve this

+4
source share
2 answers

Try this, it worked for me, don't forget to convert url to string as str (YourURLgoesHere)

 result = WebReference.gql("WHERE webreferecnce= :1", parameter) for record in result.run(limit=1): self.redirect(str(record.website)) 
0
source

You choose where r.webreferecnce = '10', and then you redirect the value of the webreferecnce field, which will be 10. Perhaps you mean something like

self.redirect (r.website) if this URL is stored. Basically, think about what you really want to do.

0
source

Source: https://habr.com/ru/post/1447905/


All Articles