Frage

I am working in google app engine , i want to redirect browser to the specific URL which is retrived from Datastore.

The model of stored URL is like,

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

My code is ,

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 the website who have webreference number 10. This is running at localhost but not after uploading. how can i achieve this ?

War es hilfreich?

Lösung

Try this one , this is worked for me, dont forget to convert url in string like str(YourURLgoesHere)

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

Andere Tipps

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

self.redirect(r.website), if that's where your URL is stored. Basically, think through what you actually want to do.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top