3.5 Using Django to Automatically Create a SQLite Database with manage.py

Now that we’ve structured our data in Django, we can ask Django to build a database for us. Creating or modifying a database is a two-step process. We must first create a migration file and then the actual database. We start by examining why migrations are crucial to any project. We then generate a migration file and examine what it does. Finally, we use the migration file to build a database.

You should always use Django to build your database. One of the biggest mistakes beginners make is to try to create the database separately from Django, either before or after creating their Django models. This is a very clear instance of developers “fighting the framework.” Not ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.