【发布时间】:2015-03-24 05:45:19
【问题描述】:
我正在尝试使用 web.py 运行两个模板,但以下代码给出了以下错误。[500 内部服务器]
感谢您的帮助!
import web
import pymongo
import datetime
render = web.template.render('templates/')
urls = (
'/', 'login'
'/index', 'index'
)
app = web.application(urls, globals())
web.config.debug= False
class login:
def GET(self):
return render.login()
def POST(self):
i=web.input()
print i
class index:
def GET(self):
return render.index()
def POST(self):
i=web.input()
print i
if __name__ == "__main__":app.run()
追溯:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 239, in process
return self.handle()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 230, in handle
return self._delegate(fn, self.fvars, args)
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 419, in _delegate
cls = fvars[f]
KeyError: u'login/index'
127.0.0.1:44423 - - [24/Mar/2015 11:03:17] "HTTP/1.1 GET /" - 500 Internal Server Error
【问题讨论】:
标签: mongodb python-2.7 pymongo ubuntu-14.04 web.py