DEV Community

Cover image for Django Creating New Project Cheat Sheet
Mohammad Ali Reza
Mohammad Ali Reza

Posted on

Django Creating New Project Cheat Sheet

Part of Django 3.2 docs:
Optimizing PostgreSQL’s configuration

Django needs the following parameters for its database connections:

client_encoding: 'UTF8',
default_transaction_isolation: 'read committed' by default, or the value set in the connection options (see below),

timezone:
        when USE_TZ is True, 'UTC' by default, or the TIME_ZONE value set for the connection,
        when USE_TZ is False, the value of the global TIME_ZONE setting.
Enter fullscreen mode Exit fullscreen mode

If these parameters already have the correct values, Django won’t set them for every new connection, which improves performance slightly. You can configure them directly in postgresql.conf or more conveniently per database user with ALTER ROLE.

Django will work just fine without this optimization, but each new connection will do some additional queries to set these parameters.

Top comments (0)