The Python Oracle

How Django atomic requests works?

This video explains
How Django atomic requests works?

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Music Box Puzzles

--

Chapters
00:00 Question
01:27 Accepted answer (Score 45)
01:51 Thank you

--

Full question
https://stackoverflow.com/questions/2734...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #atomic #djangodatabase

#avk47



ACCEPTED ANSWER

Score 47


ATOMIC_REQUESTS is an an attribute of the database connection settings dict, not the top-level settings. So, for example:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydatabase',
        'USER': 'mydatabaseuser',
        'PASSWORD': 'mypassword',
        'HOST': '127.0.0.1',
        'PORT': '5432',
        'ATOMIC_REQUESTS': True,
    }
}