On Sun, Oct 18, 2015 at 10:44 AM, rahul pathak <[email protected]>
wrote:

> Hi,
>
> I started with python web module and i have no experience with web.
>
> I used the example which is on the web.py site -
>
> ----------------------------------
> import web
>
> urls = {
>         '/', 'index'
> }
>
> class index:
>         def GET(self):
>                 return "Hello World"
>
> if __name__ == "__main__":
>         app = web.application(urls, globals())
>         app.run()
> -----------------------------------------
>
> But when I execute this code on terminal and put http://localhost:8080/ in
> browser then I get  "not found"  in browser and at terminal I get error -
>
> $ python webse.py
> http://0.0.0.0:8080/
> 127.0.0.1:51204 - - [18/Oct/2015 10:29:46] "HTTP/1.1 GET /" - 404 Not
> Found
> 127.0.0.1:51204 - - [18/Oct/2015 10:29:47] "HTTP/1.1 GET /" - 404 Not
> Found
> 127.0.0.1:51204 - - [18/Oct/2015 10:29:47] "HTTP/1.1 GET /" - 404 Not
> Found
>
> Looks like GET method is not visible and not getting executed.
>

There is an issue with your URLs. You've used curly brackets {} instead of
parenthesis () for enclosing urls. That makes them a set and set is
unordered. I think the order of them got changed.

    >>> urls = {
    ...         '/', 'index'
    ... }
    >>> print urls
    set(['index', '/'])

enclosing the urls in parenthesis will solve the issue.

Anand

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to