Configuring the Database
Let's see how we can configure a database in a Django project.
We'll cover the following...
Now that we are familiar with the structure of a Django project, let’s learn how to configure the project to connect to a database.
Django, by default, uses sqlite3 as a database, which is an in-process library that implements a fast self-contained, zero-configuration, serverless, transactional SQL database engine. It’s very compact and easy to use and set up. It’s ideal for testing or if we're looking to save data quickly. However, it comes with some disadvantages.
First of all, there are no multi-user capabilities, which means that it comes with a lack of granular access control and some security capabilities. This is due to the fact that SQLite reads and writes directly to an ordinary disk file.
For example, in our project, after running the migrations, we’ll notice the creation of a new file, db.sqlite3
. Well, this is actually our database!
We will be replacing it with a more powerful SMDB ...