librelist archives

« back to archive

404 error

404 error

From:
Vijayakumar Raju
Date:
2012-05-22 @ 19:40
Hi,

I got a 404 error (Not Found) error when i tried the sample web application
(microblog application)

I fixed the problem with the help of my friend by moving the files from *
flaskr* directory
to */var/www/*

But i'm looking for a solution where i can create a folder any where in my
system and
create an application. It looks like a temperory solution to me.

Could anyone provide some hints. I'm using Ubuntu 11.10

Best Regards,
Vijayakumar Raju

404 Error

From:
Daniel Nümm
Date:
2012-11-29 @ 13:03
Hi,

i have a strange 404 problem with the following code. If i use the test 
form everything is fine. But if I try to request this URL with the 
"logging.handlers.HTTPHandler" from an other script. Flask returns a 404 
Error. The only difference i see is the HTTP Protocol version. 

Is there a limitation for the local server or some thing else i missed...

thx.

Daniel



# Flask Routing 

@app.route('/log/', methods=['GET', 'POST'])
def log_trigger( ):
    print request.form
    return '''<form action="#" method="post"><input type="text" 
name="test"></form>'''


ImmutableMultiDict([('test', u'value')])
127.0.0.1 - - [29/Nov/2012 13:44:41] "POST /log/ HTTP/1.1" 200 -


import logging
import logging.handlers
logger = logging.getLogger('myapplogger')
logger.setLevel(logging.DEBUG)
http_handler = logging.handlers.HTTPHandler( '127.0.0.1:5000', '/log/', 
method='POST' )
logger.addHandler(http_handler)
logger.info('testing remote logging')


127.0.0.1 - - [29/Nov/2012 13:48:50] "POST /log/ HTTP/1.0" 404 -

Re: [flask] 404 Error

From:
Sean Whalen
Date:
2012-11-29 @ 13:22
Do you have SERVER_NAME set?


On Thu, Nov 29, 2012 at 8:03 AM, Daniel Nümm <daniel.nuemm@eightbrain.org>wrote:

> Hi,
>
> i have a strange 404 problem with the following code. If i use the test
> form everything is fine. But if I try to request this URL with the
> "logging.handlers.HTTPHandler" from an other script. Flask returns a 404
> Error. The only difference i see is the HTTP Protocol version.
>
> Is there a limitation for the local server or some thing else i missed...
>
> thx.
>
> Daniel
>
>
>
> # Flask Routing
>
> @app.route('/log/', methods=['GET', 'POST'])
> def log_trigger( ):
>     print request.form
>     return '''<form action="#" method="post"><input type="text"
> name="test"></form>'''
>
>
> ImmutableMultiDict([('test', u'value')])
> 127.0.0.1 - - [29/Nov/2012 13:44:41] "POST /log/ HTTP/1.1" 200 -
>
>
> import logging
> import logging.handlers
> logger = logging.getLogger('myapplogger')
> logger.setLevel(logging.DEBUG)
> http_handler = logging.handlers.HTTPHandler( '127.0.0.1:5000', '/log/',
> method='POST' )
> logger.addHandler(http_handler)
> logger.info('testing remote logging')
>
>
> 127.0.0.1 - - [29/Nov/2012 13:48:50] "POST /log/ HTTP/1.0" 404 -
>

Re: [flask] 404 Error

From:
Daniel Nümm
Date:
2012-11-29 @ 13:50
It works. But only for the first request. 

I add a print app.config['SERVER_NAME'] in before_request() and something 
change the var from 127.0.0.1 to 127.0.0.1:5000 after the first request.

127.0.0.1
ImmutableMultiDict([('relativeCreated', u'4158419.74711'), ('process', 
u'2160'), ('args', u'()'), ('module', u'<stdin>'), ('funcName', 
u'<module>'), ('exc_text', u'None'), ('name', u'mylogger'), ('thread', 
u'140735125148032'), ('created', u'1354196634.66'), ('threadName', 
u'MainThread'), ('msecs', u'655.889034271'), ('filename', u'<stdin>'), 
('levelno', u'20'), ('processName', u'MainProcess'), ('pathname', 
u'<stdin>'), ('lineno', u'1'), ('msg', u'testing remote logging'), 
('exc_info', u'None'), ('levelname', u'INFO')])
127.0.0.1 - - [29/Nov/2012 14:43:54] "POST /log/ HTTP/1.0" 200 -
127.0.0.1:5000
127.0.0.1 - - [29/Nov/2012 14:43:57] "POST /log/ HTTP/1.0" 404 -



Am 29.11.2012 um 14:22 schrieb Sean Whalen <whalenster@gmail.com>:

> Do you have SERVER_NAME set?

Re: [flask] 404 Error

From:
Daniel Nümm
Date:
2012-11-29 @ 13:36
Set  "SERVER_NAME" to "127.0.0.1" and it works :)

But i don't understand why it works without in other Clients.


Am 29.11.2012 um 14:22 schrieb Sean Whalen <whalenster@gmail.com>:

> Do you have SERVER_NAME set?
> 
> 
> On Thu, Nov 29, 2012 at 8:03 AM, Daniel Nümm 
<daniel.nuemm@eightbrain.org> wrote:
> Hi,
> 
> i have a strange 404 problem with the following code. If i use the test 
form everything is fine. But if I try to request this URL with the 
"logging.handlers.HTTPHandler" from an other script. Flask returns a 404 
Error. The only difference i see is the HTTP Protocol version.
> 
> Is there a limitation for the local server or some thing else i missed...
> 
> thx.
> 
> Daniel
> 
> 
> 
> # Flask Routing
> 
> @app.route('/log/', methods=['GET', 'POST'])
> def log_trigger( ):
>     print request.form
>     return '''<form action="#" method="post"><input type="text" 
name="test"></form>'''
> 
> 
> ImmutableMultiDict([('test', u'value')])
> 127.0.0.1 - - [29/Nov/2012 13:44:41] "POST /log/ HTTP/1.1" 200 -
> 
> 
> import logging
> import logging.handlers
> logger = logging.getLogger('myapplogger')
> logger.setLevel(logging.DEBUG)
> http_handler = logging.handlers.HTTPHandler( '127.0.0.1:5000', '/log/', 
method='POST' )
> logger.addHandler(http_handler)
> logger.info('testing remote logging')
> 
> 
> 127.0.0.1 - - [29/Nov/2012 13:48:50] "POST /log/ HTTP/1.0" 404 -
> 

Re: [flask] 404 Error

From:
Sean Whalen
Date:
2012-11-29 @ 13:51
HTTP 1.1 requires that a host header is sent with the request. I don't know
enough about Flask yet to explain why two different versions of the
protocol are used.

http://stackoverflow.com/questions/246859/http-1-0-vs-1-1

Re: [flask] 404 error

From:
Simon Sapin
Date:
2012-05-24 @ 07:43
Le 22/05/2012 21:40, Vijayakumar Raju a écrit :
> Hi,
>
> I got a 404 error (Not Found) error when i tried the sample web
> application (microblog application)
>
> I fixed the problem with the help of my friend by moving the files from
> *flaskr* directory
> to */var/www/*
>
> But i'm looking for a solution where i can create a folder any where in
> my system and
> create an application. It looks like a temperory solution to me.


Hi,

Can you provide more details on what exactly you are doing, what you 
expected to see, and what happens instead? If you get a traceback, can 
you copy it in full? If not, try in debug mode (app.debug = True)

Are you using Flaskr from the "Tutorial" part of the documentation? How 
are you starting the server, with 'python flaskr.py' or with another 
HTTP server such as Apache or nginx?

Regards,
-- 
Simon Sapin

Re: [flask] 404 error

From:
Vijayakumar Raju
Date:
2012-05-26 @ 20:40
Hi Simon,

I'm not getting any error, its working now.
I didn’t make any changes and I’m using the tutorial from the documentation.

Thank you for the response.

Best Regards,
Vijayakumar Raju

On Thu, May 24, 2012 at 9:43 AM, Simon Sapin <simon.sapin@exyr.org> wrote:

> Le 22/05/2012 21:40, Vijayakumar Raju a écrit :
> > Hi,
> >
> > I got a 404 error (Not Found) error when i tried the sample web
> > application (microblog application)
> >
> > I fixed the problem with the help of my friend by moving the files from
> > *flaskr* directory
> > to */var/www/*
> >
> > But i'm looking for a solution where i can create a folder any where in
> > my system and
> > create an application. It looks like a temperory solution to me.
>
>
> Hi,
>
> Can you provide more details on what exactly you are doing, what you
> expected to see, and what happens instead? If you get a traceback, can
> you copy it in full? If not, try in debug mode (app.debug = True)
>
> Are you using Flaskr from the "Tutorial" part of the documentation? How
> are you starting the server, with 'python flaskr.py' or with another
> HTTP server such as Apache or nginx?
>
> Regards,
> --
> Simon Sapin
>