1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

odoo を migrate したら static file が読めなくなったり cache hit しなくなったりした場合

Posted at

odoo を migrate したり、 http だったドメインに ssl を導入したりすると、ブラウザで static file の読み込みに失敗してスカスカなページを見せられたりします。
あとは下記のようなキャッシュミスが起きたりします。

web_1    | Traceback (most recent call last):
web_1    |   File "/usr/lib/python3/dist-packages/odoo/fields.py", line 996, in __get__
web_1    |     value = env.cache.get(record, self)
web_1    |   File "/usr/lib/python3/dist-packages/odoo/api.py", line 751, in get
web_1    |     raise CacheMiss(record, field)
web_1    | odoo.exceptions.CacheMiss: ('ir.attachment(333,).datas', None)
web_1    |
web_1    | During handling of the above exception, another exception occurred:
web_1    |
web_1    | Traceback (most recent call last):
web_1    |   File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_attachment.py", line 103, in _file_read
web_1    |     with open(full_path,'rb') as fd:
web_1    | FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/odoo/filestore/test1/2f/2f7028932480cdcb927f83b0165d577669e620fa'
web_1    | 2020-05-11 05:28:15,085 21 INFO test1 werkzeug: 172.21.0.4 - - [11/May/2020 05:28:15] "GET /web/image/website/1/favicon?unique=0ce65e3 HTTP/1.0" 200 - 8 0.003 0.010

そんなときは DB からキャッシュに関するデータを削除してキャッシュを構築しなおしましょう。

static file が読めないだけならこれでいけるはず。

DELETE FROM ir_attachment WHERE url LIKE '/web/content/%';

上記ログのように filestore/hogehoge とか言われてたらこれだけでは治らないので思いっきってまとめてキャッシュ関連のデータを消してしまいます。

DELETE FROM ir_attachment;

ブラウザのログもサーバのログも綺麗になれば成功です。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?