Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
12613 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
lokak. 20
4339
2
elok. 23
6235
1
heinäk. 25
1647
4
huhtik. 25
11936
1
helmik. 25
3367