Friday, 16 August 2013

Django make_password too slow for creating large list of users programatically

Django make_password too slow for creating large list of users
programatically

I need to create hundreds (possibly thousands) of users programatically in
Django. I am using something like:
from django.contrib.auth.models import User
from django.contrib.auth.hashers import make_password
for username, email, pwd in big_user_list:
m = User(username=username, email=email, password=make_password(pwd))
m.save()
This is taking too long to execute. I've confirmed that make_password is
the culprit by running the above script without passwords.
Is there anyway around this slowness issue, I really need this script to
execute quickly.

No comments:

Post a Comment