DAOCLOUD
推荐学习书目
Python Cookbook
Using Google App Engine
推荐下载
Latest Google App Engine SDK
其他兼容技术
AppScale
wickila

GAE的页面定向问题,求高手帮忙看一下

  •  
  •   wickila · Apr 26, 2011 · 5057 views
    This topic created in 5546 days ago, the information mentioned may be changed or developed.
    from google.appengine.api import memcache
    from google.appengine.ext import webapp
    from google.appengine.ext.webapp.util import run_wsgi_app
    import os

    class usertest(webapp.RequestHandler):
    def get(self):
    user = memcache.get('user')
    if user == None:
    self.redirect('/login', '/')
    else:
    self.response.out.write("欢迎回来"+user.uname)


    class login(webapp.RequestHandler):
    def get(self):
    self.response.headers['Content-Type'] = 'text/html'
    self.response.out.write("login")


    class auth(webapp.RequestHandler):
    def get(self):
    if True:
    self.redirect(self.request.get('redirect'))


    application = webapp.WSGIApplication([('/', usertest),('/login',login),('/auth',auth),],
    debug=True)


    def main():
    run_wsgi_app(application)


    if __name__ == '__main__':
    main()

    这段代码中本地运行以后,输入localhost:8080/login以后总是返回404错误,直接输入localhost:8080就可以随意定向到哪个页面。
    配置文件app.yaml如下
    application: usertest
    version: 1
    runtime: python
    api_version: 1

    handlers:
    - url: /*
    script: usertest.py
    求高手帮忙看一下是为什么
    2 replies    1970-01-01 08:00:00 +08:00
    keakon
        1
    keakon  
       Apr 26, 2011
    - url: /.*
    你少写一个.
    wickila
        2
    wickila  
    OP
       Apr 26, 2011
    @keakon 嗯!确实是的,非常感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3333 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 11:41 · PVG 19:41 · LAX 04:41 · JFK 07:41
    ♥ Do have faith in what you're doing.