V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
DAOCLOUD
推荐学习书目
Python Cookbook
Using Google App Engine
推荐下载
Latest Google App Engine SDK
其他兼容技术
AppScale
wickila
V2EX  ›  Google App Engine

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

  •  
  •   wickila · 2011-04-26 14:27:04 +08:00 · 4251 次点击
    这是一个创建于 4749 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 条回复    1970-01-01 08:00:00 +08:00
    keakon
        1
    keakon  
       2011-04-26 14:56:31 +08:00
    - url: /.*
    你少写一个.
    wickila
        2
    wickila  
    OP
       2011-04-26 15:01:23 +08:00
    @keakon 嗯!确实是的,非常感谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1180 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:37 · PVG 07:37 · LAX 16:37 · JFK 19:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.