Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
12640 Lượt xem

Hello, I need a way to differ when I am running my server locally or when I am running it on Odoo.sh. I thought that maybe the easiest way to do so would be to use an environment variable.

When I am running the server locally, I can simply 'export ODOO_ENV="local"' and then access it on python through 'os.environ.get('ODOO_ENV')'.

But is it possible to add environment variable on odoo.sh in a way that I could, for example, differ production from staging?

Thank you!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello, 

The question date a bit, but I think that the answer lies in you text already. On odoo.sh you can start a shell and an odoo-shell with odoo-bin shell, the inspect the available variables with os.environ.
You'll find the variable ODOO_STAGE which can be dev, staging or production. 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 20
4347
2
thg 8 23
6259
1
thg 7 25
1662
4
thg 4 25
11963
1
thg 2 25
3378