我是python的新手。
我使用pyramid framewok创建了一个应用程序,但是我收到了错误
ImportError: No module named myapp
我的堆栈跟踪如下
2014-11-28 19:22:44,561 ERROR [pyramid_debugtoolbar][Dummy-1] Exception at http://127.0.0.1:9999/
traceback url: http://127.0.0.1:9999/_debug_toolbar/exception?token=a64896d3bad076fe2980&tb=140525154036112
Traceback (most recent call last):
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_debugtoolbar-2.2.2-py2.7.egg/pyramid_debugtoolbar/toolbar.py", line 177, in toolbar_tween
response = _handler(request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_debugtoolbar-2.2.2-py2.7.egg/pyramid_debugtoolbar/panels/performance.py", line 57, in resource_timer_handler
result = handler(request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_tm-0.8-py2.7.egg/pyramid_tm/__init__.py", line 92, in tm_tween
reraise(*exc_info)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_tm-0.8-py2.7.egg/pyramid_tm/__init__.py", line 73, in tm_tween
response = handler(request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/router.py", line 163, in handle_request
response = view_callable(context, request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/config/views.py", line 377, in rendered_view
context)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/renderers.py", line 418, in render_view
return self.render_to_response(response, system, request=request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/renderers.py", line 441, in render_to_response
result = self.render(value, system_values, request=request)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/renderers.py", line 421, in render
renderer = self.renderer
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/decorator.py", line 37, in __get__
val = self.wrapped(inst)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/renderers.py", line 405, in renderer
return factory(self)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_chameleon-0.3-py2.7.egg/pyramid_chameleon/zpt.py", line 10, in renderer_factory
return renderer.template_renderer_factory(info, ZPTTemplateRenderer)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_chameleon-0.3-py2.7.egg/pyramid_chameleon/renderer.py", line 140, in template_renderer_factory
return lookup(info)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pyramid_chameleon-0.3-py2.7.egg/pyramid_chameleon/renderer.py", line 115, in __call__
filename)
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pkg_resources.py", line 949, in resource_filename
return get_provider(package_or_requirement).get_resource_filename(
File "/home/techencephalon/env/local/lib/python2.7/site-packages/pkg_resources.py", line 229, in get_provider
__import__(moduleOrReq)
ImportError: No module named myapp
我不知道这个错误,无法解决这个问题。
我在这个应用程序中使用mongodb。
答案 0 :(得分:1)
我建议新手使用Quick Tutorial,以便深入了解如何使用Pyramid作为媒介在Python中开发Web应用程序。
答案 1 :(得分:0)
我知道我迟到了,
使用模块(金字塔用途)导入python有点棘手。
我是做什么的
例如,在it('+++ incorporates Search', () => {
wrapper.setState({ hasError: true });
console.log(wrapper.debug());
});
views.py
和from .tablas import julio2019
#import .tablas #if you want
ancho =12
alto = 7
color ='#0CA309'
html4 = julio2019(ancho,alto,color)
应该与tablas.py
对于您来说,views.py
可能不在同一目录中,或者您省略了该点。请注意,在使用myApp
函数时,不必使用添加julio2019
,但如果需要,可以使用。