首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未找到公共url (404个-Not找到) -Odoo10

未找到公共url (404个-Not找到) -Odoo10
EN

Stack Overflow用户
提问于 2020-02-27 14:30:17
回答 1查看 2K关注 0票数 1

我在Odoo10中创建了一个具有json类型的公共路由,并试图从API ( ARC)调用它,我得到了404未找到的错误。我也不知道原因。

这是我的密码

controller.py

代码语言:javascript
复制
# -*- coding: utf-8 -*-
from odoo import http,tools
from odoo.http import request, Response
import requests
class TestURL(http.Controller):
    @http.route('/create_lead', type="json", method=['POST'], auth='public', csrf=False)
   def createLead(self,**kw):
       print('Inside create lead')
       // rest of the code here

下面是我在api客户机中得到的响应:

代码语言:javascript
复制
{"jsonrpc": "2.0", "id": null, "error": {"message": "404: Not Found", "code": 404, "data": {"debug": "Traceback (most recent call last):\n  File \"/home/user/Projects/odoo-10/odoo/http.py\", line 642, in _handle_exception\n    return super(JsonRequest, self)._handle_exception(exception)\n  File \"/home/user/Projects/odoo-10/odoo/http.py\", line 1471, in _dispatch_nodb\n    func, arguments = self.nodb_routing_map.bind_to_environ(request.httprequest.environ).match()\n  File \"/usr/local/lib/python2.7/dist-packages/werkzeug/routing.py\", line 1581, in match\n    raise NotFound()\nNotFound: 404 Not Found: The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.\n", "exception_type": "internal_error", "message": "404 Not Found: The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.", "name": "werkzeug.exceptions.NotFound", "arguments": []}, "http_status": 404}}
EN

回答 1

Stack Overflow用户

发布于 2020-02-27 17:23:59

试一试

代码语言:javascript
复制
@http.route(['/create_lead']...

检查压痕

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60435490

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档