The Python Oracle

Autocommit Migration from Django 1.7 to 1.8

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: Mysterious Puzzle

--

Chapters
00:00 Question
02:03 Accepted answer (Score 14)
02:56 Thank you

--

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

Accepted answer links:
[Django 1.7 Databases docs]: https://docs.djangoproject.com/en/1.7/re...
[1.8 Release Notes]: https://docs.djangoproject.com/en/1.8/re...

--

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

--

Tags
#python #django

#avk47



ACCEPTED ANSWER

Score 14


The following was outlined in the Django 1.7 Databases docs:

In previous versions of Django, database-level autocommit could be enabled by setting the autocommit key in the OPTIONS part of your database configuration in DATABASES.

Since Django 1.6, autocommit is turned on by default. This configuration is ignored and can be safely removed.

And as per the 1.8 Release Notes, this feature was removed.

If you still want to keep the setting for some reason, simply move it out of OPTIONS:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'HOST': 'localhost',
        'PORT': '5432',
        'NAME': 'bp_django_auth',
        'USER': 'postgres',
        'PASSWORD': 'abcd1234',
        'AUTOCOMMIT': True,
    }
}