Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
12645 Visninger

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
Kassér
Bedste svar

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
okt. 20
4351
2
aug. 23
6261
1
jul. 25
1663
4
apr. 25
11968
1
feb. 25
3379