How to Use a Different Database Other than SQLite in Django

By: Dusty Arlia
Published on Friday, January 24, 2014, 10:46 AM
Last Updated on Friday, July 10, 2015 at 6:03 PM
Total Updates: 3

To use another database other than SQLite, install the appropriate database bindings and change the following DATABASES 'default' keys to use the settings for your new database:

  • ENGINE - Here are your choices: 'django.db.backends.sqlite3', 'django.db.backends.postgresql_psycopg2', 'django.db.backends.mysql', or''. There are other backends that you can use.
  • NAME - This key holds the name of your database. If you're using SQLite, the database will be a file on your computer. If this is the case, the NAME value should be the full absolute path, including filename, of that file. The default value, os.path.join(BASE_DIR, 'db.sqlite3'), will store the file in your project directory.

If you are not using SQLite as your database, additional settings such as USER, PASSWORD, and HOST must be added.