Categories
django mysql passwords postgresql python

Migrating a password field to Django

I have used Django before (version 1.2) and generally I like it… it is especially good at getting a brand new project up and running quickly. But, in this case, I’m rewriting and existing system and moving it to Python/Django. So, I already have a MySQL database that has a “users” table in it… this table stores the user’s password with the MySQL SHA1 function (no salt, etc).

As part of the migration, I’m going to fix some of the data modeling flaws and port to PostgreSQL.

I would really like to use django.contrib.auth, but I’m unclear what I need to do. I have read the documentation, and know that I can separate the required user information and the “extra” information I have and put it into UserProfile.

But, how to handle the passwords stored in the MySQL db?

Has anyone handled this before? What approach did you take?