[Django]-Postgres & Django – DataError: time zone not recognized

3👍

There are two problems:

  1. Timezone definitions change over time. Update Ubuntu timezone data:
    sudo apt-get update
    sudo apt-get install tzdata
    
  2. Postgres 11.1 doesn’t support this timezone (and some others). Update Postgres to 11.4:
    sudo apt-get update
    sudo apt-get install postgresql-11
    sudo apt-get install postgresql-client-11
    

Some notes on updating Postgres:

  1. No data migration needed for minor versions (e.g. 11.0 -> 11.4). Only executables are updated.
  2. PostgreSQL will restart (database will be unavailable for a second or two)

The relevant postgresql changelog (https://www.postgresql.org/docs/release/11.2/):

Update time zone data files to tzdata release 2018i for DST law changes in Kazakhstan, Metlakatla, and Sao Tome and Principe. Kazakhstan’s Qyzylorda zone is split in two, creating a new zone Asia/Qostanay, as some areas did not change UTC offset. Historical corrections for Hong Kong and numerous Pacific islands.

Leave a comment