librelist archives

« back to archive

Unknown error when doing a request

Unknown error when doing a request

From:
Jose Ayerdis
Date:
2013-02-28 @ 00:12
Can someone help me out to know how or when this error might appear? I know
is very vague but I have done the same request both with REST chrome plugin
and does not happened but whenever I try to do it within the app with JS
this happened any clue?

A request was sent to this URL (http://localhost:5000/login) but a redirect
was issued automatically by the routing system to "
http://localhost:5000/login/". The URL was defined with a trailing slash so
Flask will automatically redirect to the URL with the trailing slash if it
was accessed without one. Make sure to directly send your POST-request to
this URL since we can't make browsers or HTTP clients redirect with form
data reliably or without user interaction.Note: this exception is only
raised in debug mode


Sincerly yours,

[Jose Luis Ayerdis Espinoza]
Necronet.info |
LinkedIn<http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704>|
Careers
StackOverflow <http://careers.stackoverflow.com/necronet>

Re: [flask] Unknown error when doing a request

From:
Alex Ogier
Date:
2013-02-28 @ 00:28
It looks like you are submitting a POST request to the url "/login" but
your flask route is for the url "/login/". This might be caused by a form
with action="login" or action="/login", or a JavaScript request to "login"
or "/login" (for example, $.post("login") or similar if you use jquery).
The fix is to find where that url comes from and add a trailing slash.

Best,
Alex Ogier
On Feb 27, 2013 7:14 PM, "Jose Ayerdis" <joseayerdis@gmail.com> wrote:

> Can someone help me out to know how or when this error might appear? I
> know is very vague but I have done the same request both with REST chrome
> plugin and does not happened but whenever I try to do it within the app
> with JS this happened any clue?
>
> A request was sent to this URL (http://localhost:5000/login) but a
> redirect was issued automatically by the routing system to "
> http://localhost:5000/login/". The URL was defined with a trailing slash
> so Flask will automatically redirect to the URL with the trailing slash if
> it was accessed without one. Make sure to directly send your POST-request
> to this URL since we can't make browsers or HTTP clients redirect with form
> data reliably or without user interaction.Note: this exception is only
> raised in debug mode
>
>
> Sincerly yours,
>
> [Jose Luis Ayerdis Espinoza]
> Necronet.info | 
LinkedIn<http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704>|
Careers
> StackOverflow <http://careers.stackoverflow.com/necronet>
>

Re: [flask] Unknown error when doing a request

From:
Somit Srivastava
Date:
2013-02-28 @ 06:50
Keep all your url with a trailing slash(/) and set debug=false in app.run .
Flask automatically appends a / with every url. So even if you miss a slash
while hitting a url it will work.
This is how i did it.

--Somit

On Thu, Feb 28, 2013 at 5:58 AM, Alex Ogier <alex.ogier@gmail.com> wrote:

> It looks like you are submitting a POST request to the url "/login" but
> your flask route is for the url "/login/". This might be caused by a form
> with action="login" or action="/login", or a JavaScript request to "login"
> or "/login" (for example, $.post("login") or similar if you use jquery).
> The fix is to find where that url comes from and add a trailing slash.
>
> Best,
> Alex Ogier
> On Feb 27, 2013 7:14 PM, "Jose Ayerdis" <joseayerdis@gmail.com> wrote:
>
>> Can someone help me out to know how or when this error might appear? I
>> know is very vague but I have done the same request both with REST chrome
>> plugin and does not happened but whenever I try to do it within the app
>> with JS this happened any clue?
>>
>> A request was sent to this URL (http://localhost:5000/login) but a
>> redirect was issued automatically by the routing system to "
>> http://localhost:5000/login/". The URL was defined with a trailing slash
>> so Flask will automatically redirect to the URL with the trailing slash if
>> it was accessed without one. Make sure to directly send your POST-request
>> to this URL since we can't make browsers or HTTP clients redirect with form
>> data reliably or without user interaction.Note: this exception is only
>> raised in debug mode
>>
>>
>> Sincerly yours,
>>
>> [Jose Luis Ayerdis Espinoza]
>> Necronet.info | 
LinkedIn<http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704>|
Careers
>> StackOverflow <http://careers.stackoverflow.com/necronet>
>>
>