gpt4 book ai didi

xml - Odoo 路由给出 "Internal Server Error"错误页面

转载 作者:行者123 更新时间:2023-12-04 19:00:57 29 4
gpt4 key购买 nike

我正在通过在 Youtube 视频中创建一个新的自定义模块来在 Ubuntu 上学习 Odoo 11 python 开发,其代码可在 github 上找到。

我复制了同一个项目( https://github.com/mtsoftware2016/Odoo-First-Model ),除了路线外一切正常。

Controller .py:

from odoo import http

class MyfirstModel(http.Controller):
@http.route('/home', auth='public')
def home(self, **kw):
return 'Hello world'

@http.route('/example', type='http', auth='public', website=True)
def render_example_page(self):
customer = http.request.env['customer'].sudo().search([])
return http.request.render('myfirst_model.example_page', {'customers': customer})

这里/home 路由是有效的,但是/example 在页面上给出了这个错误消息:

内部服务器错误

服务器遇到内部错误,无法完成您的请求。服务器过载或应用程序出错。

Odoo 错误日志:
2018-10-25 10:33:58,858 4933 INFO odoo3 werkzeug: 127.0.0.1 - - [25/Oct/2018 10:33:58] "GET /example HTTP/1.1" 500 -
2018-10-25 10:33:58,880 4933 ERROR odoo3 werkzeug: Error on request:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 270, in run_wsgi
execute(self.server.app)
File "/home/ubuntu/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 258, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/odoo/odoo/service/server.py", line 250, in app
return self.app(e, s)
File "/opt/odoo/odoo/odoo/service/wsgi_server.py", line 166, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/odoo/odoo/service/wsgi_server.py", line 154, in application_unproxied
result = handler(environ, start_response)
File "/opt/odoo/odoo/odoo/http.py", line 1318, in __call__
return self.dispatch(environ, start_response)
File "/opt/odoo/odoo/odoo/http.py", line 1292, in __call__
return self.app(environ, start_wrapped)
File "/home/ubuntu/.local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 766, in __call__
return self.app(environ, start_response)
File "/opt/odoo/odoo/odoo/http.py", line 1490, in dispatch
result = ir_http._dispatch()
File "/opt/odoo/odoo/addons/web_editor/models/ir_http.py", line 22, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_http.py", line 212, in _dispatch
return cls._handle_exception(e)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_http.py", line 182, in _handle_exception
return request._handle_exception(exception)
File "/opt/odoo/odoo/odoo/http.py", line 770, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_http.py", line 208, in _dispatch
result = request.dispatch()
File "/opt/odoo/odoo/odoo/http.py", line 829, in dispatch
r = self._call_function(**self.params)
File "/opt/odoo/odoo/odoo/http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/odoo/http.py", line 338, in checked_call
result.flatten()
File "/opt/odoo/odoo/odoo/http.py", line 1269, in flatten
self.response.append(self.render())
File "/opt/odoo/odoo/odoo/http.py", line 1262, in render
return env["ir.ui.view"].render_template(self.template, self.qcontext)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_ui_view.py", line 1201, in render_template
return self.browse(self.get_view_id(template)).render(values, engine)
File "/opt/odoo/odoo/addons/web_editor/models/ir_ui_view.py", line 27, in render
return super(IrUiView, self).render(values=values, engine=engine)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_ui_view.py", line 1210, in render
return self.env[engine].render(self.id, qcontext)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 57, in render
return super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 272, in render
self.compile(template, options)(self, body.append, values or {})
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 345, in _compiled_fn
raise e
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 343, in _compiled_fn
return compiled(self, append, new, options, log)
File "<template>", line 1, in template_236_3

File "<decorator-gen-37>", line 2, in compile

File "/opt/odoo/odoo/odoo/tools/cache.py", line 89, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 77, in compile
return super(IrQWeb, self).compile(id_or_xml_id, options=options)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 289, in compile
element, document = self.get_template(template, options)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 373, in get_template
raise QWebException("load could not load template", name=template)
odoo.addons.base.ir.ir_qweb.qweb.QWebException: None
Traceback (most recent call last):
File "/opt/odoo/odoo/odoo/tools/cache.py", line 84, in lookup
r = d[key]
File "/opt/odoo/odoo/odoo/tools/func.py", line 68, in wrapper
return func(self, *args, **kwargs)
File "/opt/odoo/odoo/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: ('ir.qweb', <function IrQWeb.compile at 0x7f10b987f9d8>, 'website.layout', ('en_US', None, None, None, None, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo/odoo/odoo/tools/cache.py", line 84, in lookup
r = d[key]
File "/opt/odoo/odoo/odoo/tools/func.py", line 68, in wrapper
return func(self, *args, **kwargs)
File "/opt/odoo/odoo/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f10ba819620>, 'website.layout')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/qweb.py", line 369, in get_template
document = options.get('load', self.load)(template, options)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 85, in load
template = env['ir.ui.view'].read_template(name)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_ui_view.py", line 1096, in read_template
return self._read_template(self.get_view_id(xml_id))
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_ui_view.py", line 1108, in get_view_id
return self.env['ir.model.data'].xmlid_to_res_id(template, raise_if_not_found=True)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_model.py", line 1343, in xmlid_to_res_id
return self.xmlid_to_res_model_res_id(xmlid, raise_if_not_found)[1]
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_model.py", line 1334, in xmlid_to_res_model_res_id
return self.xmlid_lookup(xmlid)[1:3]
File "<decorator-gen-21>", line 2, in xmlid_lookup
File "/opt/odoo/odoo/odoo/tools/cache.py", line 89, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_model.py", line 1323, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: website.layout

load could not load template
Template: website.layout

example_page View :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="example_page" name="Customer Details">
<t t-call="website.layout">
<center>
<h>Customer Details</h>
</center>
</t>
</template>
</odoo>

有什么建议么?

最佳答案

通过安装 Odoo 网站模块修复了该问题。

关于xml - Odoo 路由给出 "Internal Server Error"错误页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52987553/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com