python - Flask redirects on GAE -


Hello I am using a flask on Google App Engine (http://flask.pocoo.org/) I have a low code

  @ app.route ("/ edit.html", methods = ['GET', 'POST']) def (): If request.method == 'GET': form = ImageForm () return render_template ('edit.html', title = u'Add ', form = form) if request.method ==' POST ': image = Image () form = ImageForm (Request Form , Image) if form.validate () and request.files ['image']: form.populate_obj (image) if request.files ['image']: image.file = request.files ['image']. () Image.put () Return Redirect (url_for ("edit", id = image.key ()) Other: return render_template ('edit.html', title = u'Add ', form = form) @app ( AD): image = Image.get (id) form = ImageForm (request.form, image) route ("/ edit / & lt; id & gt; Html", methods = ['GET', 'POST'] ) Return to Reader_Template ('edit.html', title = u'Edit ', form = form)   

But the browser sent me to a given URL

  Return Redirect (url_for ("edit", id = image.key ()))   

I get a message:

Image status: 302 content Type: text / html; Charset = utf-8 Location: http: // localhost: 8080 / edit / agtyb3VnaC1kcmFmdHILCxIFSW1hZ2UYDQw.html Content-Length: 299

Redirect ...

Redirecting ...

You must be automatically redirected to target URLs: /edit/agtyb3VnaC1kcmFmdHILCxIFSW1hZ2UYDQw.html. If the link is not clicked on.

I do not understand what's wrong with my code?

Output the text in response before the feedback of the FLAC framework is something in your code (it seems That's like printing 'image') - Maybe there's a print statement somewhere in your code. Consequently, the header tries to produce flasks instead of interpreted as part of the body of the reaction.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -