最近我一直在尝试学习 WebPy,当尝试在教程 ( http://webpy.org/docs/0.3/tutorial ) 中使用模板时,我在尝试访问页面时遇到了这个错误。
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/application.py", line 239, in process
return self.handle()
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/application.py", line 230, in handle
return self._delegate(fn, self.fvars, args)
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/application.py", line 420, in _delegate
return handle_class(cls)
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/application.py", line 396, in handle_class
return tocall(*args)
File "/Users/clement/Desktop/#Minecraft/index2.py", line 14, in GET
return render.index(name)
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/template.py", line 1017, in __getattr__
t = self._template(name)
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/template.py", line 1014, in _template
return self._load_template(name)
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/template.py", line 1001, in _load_template
raise AttributeError, "No template named " + name
AttributeError: No template named index
我已经在 SOF 上查看了这个问题,但我无法让它在我的情况下工作。我花了大约 4 个小时试图弄清楚这一点,并试图重新设计我启动服务的方式,这通常是通过以下方式完成的:
Macintosh-2:~ clement$ python /Users/clement/Desktop/\#Minecraft/index.py
谢谢!