2017-08-02 31 views
1

URL沒有發現我有控制器路線:Odoo:如果沒有權威性

@http.route(['/report/yandex_phone_report'], type='http', auth="public", website=True) 
def yandex_phone_report(self, **kw): 
    page_data = [] 


    return http.request.render(self._report_index_page_template, { 
     'page_items': page_data 

如果我在URL /報告記錄/ yandex_phone_report顯示的罰款。 如果我沒有在URL /報告loged/yandex_phone_report將返回404:

2017-08-02 16:46:09,400 5942 INFO ? werkzeug: 127.0.0.1 - - [02/Aug/2017 16:46:09] "GET /report/yandex_phone_report HTTP/1.1" 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. 

我怎樣才能解決呢?爲什麼路線不起作用?

回答

0

發生這種情況是因爲它不知道要在哪個數據庫中查找該URL。

如果你看看你提供的日誌,你會看到在INFO之後,你有嗎?

2017-08-02 16:46:09,400 5942 INFO ? <- THIS ONE 

而不是?,你會看到一個數據庫名稱,如果它知道它應該使用哪個數據庫。

爲了測試它,你可以先撥打:http://localhost:PORT/web?db=YOUR_DB_NAME

這將建立在瀏覽器上對給定的數據庫會話。

然後,調用http://localhost:PORT/report/yandex_phone_report將工作。

在生產環境中,您需要將其配置爲從某處獲取數據庫名稱...例如,從URL(http://dbname.example.com:PORT)。