Django: Getting Started Transcripts
Chapter: Django ORM and Databases
Lecture: Different database back-ends: Sqlite, Postgres, etc
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Inside of the settings.py file you'll find a dictionary called databases which is required
0:05
This is what it looks like when you create a new project by default. Django actually supports using multiple databases at the same time.
0:15
It isn't a common use case but boy is it handy when you need it. The default value here is the definition of the database that is used.
0:23
If the code doesn't actually explicitly ask for another database, the engine value specifies what back end code to use to interact with the database.
0:35
Out of the box, this is set to sqlite3. The other configuration here depends on what your back end is. In the case of sqlite,
0:43
all you need to do is specify the location of the database file here. It's the project directory plus the name db.sqlite3.
0:55
As I mentioned before, Django supports multiple database types and the configuration is different depending on what you're using.
1:02
For sqlite, you specify the file name. For Postgres under Django 4, you specify a Postgres service file and password file.
1:11
The service file contains things like the host name and the ports of the server. For most of the others or Postgres,
1:18
prior to Django 4 you specify the host name, port, user name and passport as part of the configuration.
1:25
If your favorite database isn't part of the Django package, there are lots of third party back ends out there that you can install.
1:31
Even some no .... if that floats your boat.