According to my test, Django's default isolation level depends on the isolation level which you set for your PostgreSQL. In other words, if you set REPEATABLE READ
for your PostgreSQL with psql, Django's default isolation level is REPEATABLE READ
.
With the raw query below, you can check the current isolation level of your PostgreSQL from settings.py
in Django. *The raw query must be run after database settings otherwise error occurs:
# "settings.py"
from django.db import connection
# ...
DATABASES = {
'default':{
'ENGINE':'django.db.backends.postgresql',
'NAME':'postgres',
'USER':'postgres',
'PASSWORD':'admin',
'HOST':'localhost',
'PORT':'5432',
},
}
cursor = connection.cursor()
cursor.execute('SHOW default_transaction_isolation;')
print(cursor.fetchone()) # ('repeatable read',)
*settings.py
is run every time Django Server is run with the command below or every time Django Server is reloaded by writing code so the raw query above is run every time Django Server is run with the command below or every time Django Server is reloaded by writing code:
python manage.py runserver 0.0.0.0:8000
In addition, you can also see my answer explaining how to set the isolation level of PostgreSQL from Django.