Supported Databases

Django officially supports five databases:

  • PostgreSQL
  • MySQL
  • SQLite
  • Oracle
  • MariaDB (Django 3 only)

There are also several third-party applications available if you need to connect to an unofficially supported database.

The preference for most Django developers, myself included, is PostgreSQL. MySQL is also a common database backend for Django. Installing and configuring a database is not a task for a beginner. Luckily, Django installs and configures SQLite automatically, with no input from you, so we will use SQLite in this book.

I cover running your project with PostgreSQL, MySQL and MariaDB in Chapter 16.

Which Database is Better?

Easy one first—SQLite is for early development and testing. Do not use in production. Ever.

Next easiest answer—Oracle is for big corporations with deep pockets. You are unlikely to need to decide whether to use Oracle unless you join a big enterprise, and then you might find it’s your only choice.

As for PostgreSQL, MariaDB (Django 3) and MySQL, there are specific reasons PostgreSQL is a better database than MySQL. However, by the time you have learned enough programming to understand why, you can judge for yourself. Most often, you don’t get a choice because the client, your employer or the web host makes it for you.

Smart programmers avoid this kind of argument—use PostgreSQL if you can; otherwise, MySQL is fine too.

MariaDB is the new kid on the Django block, with support only added with the release of Django 3.0, so I have no advice at this time.