İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
12723 Görünümler

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!

Avatar
Vazgeç
En İyi Yanı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. 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Eki 20
4433
2
Ağu 23
6421
1
Tem 25
1722
4
Nis 25
12065
1
Şub 25
3447