How to change the time zone in web2py under PythonAnywhere?

35 views
Skip to first unread message

jcrm...@gmail.com

unread,
May 7, 2019, 9:21:07 AM5/7/19
to web...@googlegroups.com
Hello,

I was able to change the time zone of the consoles to UTC+1 in PythonAnywhere, but the web2py apps are still in UTC.

Does anyone know how I can change make the web2py apps comply?

I was told to add this
os.environ["TZ"] = "Europe/Lisbon"
to the start of wsgi configuration file (located at /var/www), but that didn't work.

Thanks,

JM

jcrm...@gmail.com

unread,
May 7, 2019, 2:06:21 PM5/7/19
to web2py-users
I was able to solve it by adding
time.tzset()
after the
os.environ["TZ"] = "Europe/Lisbon"
in the wsgi configuration file (it's accessible in the Web tab).

terça-feira, 7 de Maio de 2019 às 14:21:07 UTC+1, jcrm...@gmail.com escreveu:
Hello,

I was able to change the time zone of the consoles to UTC+1 in PythonAnywhere, but the web2py apps are still in UTC.

Does anyone know how I can change make the web2py apps comply?

I was told to add this
os.environ["TZ"] = "Europe/Lisbon"

to the start of wsgi adapter (located at /var/www), but that didn't work.

Thanks,

JM

Massimo Di Pierro

unread,
May 9, 2019, 9:59:24 PM5/9/19
to web2py-users

Mind os.eviron is not thread safe. You are changing not your one app, but for all your installed web2py apps.

João Matos

unread,
May 10, 2019, 4:58:27 PM5/10/19
to web2py-users
Thanks Massimo. In this case that is exactly what I want.
Reply all
Reply to author
Forward
0 new messages