22.4 Data Migrations

When we erased our database, we removed all of the users we had previously added. I’m lazy, and if I know I need those users on my website, I am loathe to create them again every time. I’m therefore going to create a data migration to create basic user accounts.

Please take a moment to consider that what I am doing is a huge security risk. If this code is available publicly (it is) or unchanged at production (https://site.django-unleashed.com does not have these users), then these accounts are attack vectors and provide the bad people and bad robots with access to our website. In a normal website, you probably don’t want to do what I am about to. However, this website isn’t really a production website—it’s a website to learn ...

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.