[Django]-How to properly format django settings.py?

6👍

The tutorial you are following is for Django <=1.1, in 1.2 they changed the format of the database settings in order to allow for all new multiple databases. If your tutorial is telling you to create something like this:

DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/path/to/your/dev.db'

Then this is what you will need in order to implement an sqlite3 database in the 1.2 syntax:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': '/path/to/your/dev.db',
    }
}

As always see the Django documentation on the matter for more information, and for proof of my statement that this was around in version 1.1, have a look at the docs from that version.

1👍

Yes it’s a different version. From 1.2 and onwards convention for specifying database parameters has been changed to provide multi-database support(although the previous conventions should also work, to preserve backward compatibility). You should look at the official Django documentation. It’s up-to-date and quite wholesome.

Leave a comment