金字塔todo web应用程序出错

2024-04-27 20:04:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在研究金字塔待办事项列表教程:

http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/single_file_tasks/single_file_tasks.html

我的web应用程序正常工作,但我一直收到此错误,这不会阻止我的应用程序运行。在

(pyramid_tutorial)christohersmbp2:pyramid_tutorial christopherspears$ python tasks/tasks.py
WARNING:tasks/tasks.py:Initializing database...
127.0.0.1 - - [23/Mar/2014 18:59:23] "GET / HTTP/1.1" 200 891
127.0.0.1 - - [23/Mar/2014 18:59:23] "GET /static/style.css HTTP/1.1" 304 0
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/router.py", line 272, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/router.py", line 247, in invoke_subrequest
    response = handle_request(request)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/tweens.py", line 46, in excview_tween
    response = view_callable(exc, request)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/config/views.py", line 287, in _authdebug_view
    return view(context, request)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/config/views.py", line 377, in rendered_view
    context)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/renderers.py", line 416, in render_view
    return self.render_to_response(response, system, request=request)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/renderers.py", line 439, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid-1.5b1-py2.7.egg/pyramid/renderers.py", line 435, in render
    result = renderer(value, system_values)
  File "/Users/christopherspears/.virtualenvs/pyramid_tutorial/lib/python2.7/site-packages/pyramid_mako-1.0a2-py2.7.egg/pyramid_mako/__init__.py", line 122, in __call__
    raise ValueError('renderer was passed non-dictionary as value')
ValueError: renderer was passed non-dictionary as value

我不确定是什么原因造成的,因为我在回溯中没有看到我的代码。以下是我为教程编写的代码:

^{pr2}$

知道是什么问题吗?我可能只是需要一双新鲜的眼睛。在


Tags: inpypyramideggrequestlibpackagesline
1条回答
网友
1楼 · 发布于 2024-04-27 20:04:15

您的not_found_view没有返回dict。如果您在Firebug/Chrome dev tools中检查网络页面,您将看到您的页面向某些不存在的资源(favicion.ico?)-这将导致调用not_found_view,但由于异常,请求导致501响应而不是404。在

相关问题 更多 >