Hello world cant map urls!!

3 views
Skip to first unread message

Nishanth Salahudeen

unread,
Nov 23, 2009, 5:17:53 AM11/23/09
to Google App Engine
Hi,
I modified hello world example to have 3 different scripts handling 3
different url patterns. I tested them by manually entering the url
into the address bar and hit ENTER.
"Localhost:8085" shows up as "Hello world!"
"Localhost:8085/2" doest appear. It shows blank page. Log says "404
error"
i tried random things instead of "2". the result is the same as that
with "2".
Please help.

In another version, I added a button with associated it to "/2" url
and used a handler function inside the main.py script file itself(as
opposed to a separate script file). When I clicked the button, the url
path "/2" showed up properly as expected. The address bar now says
"localhost:8085/2/".At this stage if I simply click inside the address
bar to select the url and hit ENTER, the page goes blank again like
before. when I replaced the button with a simple href link to the same
address url, it doesnt work!!

what could be going wrong?
My app.yaml file is as shown below
----------------------------------start
application: multipagetry
version: 1
runtime: python
api_version: 1
handlers:
- url: /2/.*
script: main2.py
- url: /
script: main.py
- url: /.*
script: main3.py
---------------------------------end
my main.py file which works properly for address "localhost:8085/" is
as below
--------------------------------start
import wsgiref.handlers
from google.appengine.ext import webapp

class MainHandler(webapp.RequestHandler):
def get(self):
self.response.out.write('Hello world!')

def main():
application = webapp.WSGIApplication([('/', MainHandler)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
main()
---------------------------------end
my main2.py file which doesnt work properly for address "localhost:
8085/2/" is as below
--------------------------------start
import wsgiref.handlers
from google.appengine.ext import webapp

class MainHandler(webapp.RequestHandler):
def get(self):
self.response.out.write('Hello world2222!')

def main():
application = webapp.WSGIApplication([('/', MainHandler)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
main()
---------------------------------end

Stephen

unread,
Nov 23, 2009, 2:52:20 PM11/23/09
to Google App Engine


On Nov 23, 10:17 am, wizard_of_blackforest
<nishanth.salahud...@gmail.com> wrote:
>
> my main2.py file which doesnt work properly for
> address "localhost:8085/2/" is as below:
>
> def main():
>   application = webapp.WSGIApplication([('/', MainHandler)],
>                                        debug=True)


You are matching '/' but the URL is '/2'.

Nishanth Salahudeen

unread,
Nov 23, 2009, 9:29:13 PM11/23/09
to Google App Engine
Oh!!
Thanks a bunch...so stupid of me.
Got it working. Was stuck at this for over a week now (I cant believe
it)
thanks again for the patience and help.
Reply all
Reply to author
Forward
0 new messages