The Database and Config App Connection through Docker
Learn how to correctly use Docker to connect the database and application.
Specifying the database in the settings.py
file
Django automatically creates a db.sqlite3
file for us whenever we create a Django project. This is because SQLite is the default database for Django projects. However, we won't use this database. Instead, we'll delete the file and create our database of choice.
Let’s go to the settings.py
file and specify the database—MySQL—we wish to use. In this file, we'll locate the DATABASES
segment of the code and replace these lines:
Get hands-on with 1400+ tech skills courses.