ImportError:在odoo中没有名为http的模块

时间:2017-07-09 13:53:35

标签: python openerp odoo-10

当我尝试为网络编写基本控制器时,

错误在odoo 10中

from odoo import http

显示错误

2017-07-09 13:20:10,128 9183 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/odoo/odoo-server/odoo/service/server.py", line 250, in app
    return self.app(e, s)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 184, in application
    return application_unproxied(environ, start_response)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 170, in application_unproxied
    result = handler(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1307, in __call__
    self.load_addons()
  File "/odoo/odoo-server/odoo/http.py", line 1328, in load_addons
    m = __import__('odoo.addons.' + module)
  File "/odoo/odoo-server/odoo/modules/module.py", line 81, in load_module
    execfile(modfile, new_mod.__dict__)
  File "/odoo/odoo-server/addons/web_printscreen_zb/__init__.py", line 25, in <module>
    import controllers
  File "/odoo/odoo-server/addons/web_printscreen_zb/controllers.py", line 28, in <module>
    import openerp.addons.web.http as openerpweb
  File "/odoo/odoo-server/odoo/modules/module.py", line 109, in load_module
    mod = importlib.import_module(canonical)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named http

我阅读了odoo的文档来编写Web控制器但结果相同。

和 我试过

来自odoo.addons.web导入http

相同的结果

2 个答案:

答案 0 :(得分:1)

问题已经解决了 将代码从controller.py移动到另一个文件file.py 我不知道为什么会这样......!

答案 1 :(得分:0)

尝试以下

import odoo.http as http