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

2011-04-26 14:27:04 +08:00
 wickila
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
求高手帮忙看一下是为什么
4258 次点击
所在节点    Google App Engine
2 条回复
keakon
2011-04-26 14:56:31 +08:00
- url: /.*
你少写一个.
wickila
2011-04-26 15:01:23 +08:00
@keakon 嗯!确实是的,非常感谢!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/12150

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX