0
最近我一直在試圖學習WebPy,當試圖在教程中使用模板(http://webpy.org/docs/0.3/tutorial)時,在嘗試訪問該頁面時遇到此錯誤。WebPy:AttributeError沒有名爲index的模板
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
我看了這個Question上SOF,但我不能讓它在我的情況下工作。我花了大約4個小時試圖弄清楚這一點,並試圖返工我推出的服務的方式,通常通過做:
Macintosh-2:~ clement$ python /Users/clement/Desktop/\#Minecraft/index.py
謝謝!
如果你展示了一些源代碼而不僅僅是回溯,它會有幫助 –
我認爲你確實遵循了'讓我們爲我們的模板創建一個新目錄(我們會稱之爲模板)。在裏面,創建一個名稱以HTML結尾的新文件(我們將其稱爲index.html)。現在,在裏面,你可以編寫普通的HTML:'? –