I keep needing to do this, darn it! I leave a project for a few months, possibly push it live, and then I go back to fire up the dev server but I simply cannot remember the password I used for admin during development.
Why don’t I use my stupid-development-password? I don’t know, but this seems to happen with some regularity.
Luckily, it is trivial to fix with a few lines at the python commandline:
Deep:/opt/webapps/invisible bruce$ ./manage.py shell
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
Type "copyright", "credits" or "license" for more information.
IPython 0.7.2 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In : from django.contrib.auth.models import User
In : users = User.objects.all()
In : users
Out: [<User: admin>]
In : users.set_password('whatever');
In : users.save()
That’s it, fire up the dev server again and your new password will get you in.
- Howto use Satchmo as an App I'm going to be using Satchmo to power the backend...
- Helpful Django utilities and links Two simple links which have been very helpful in doing...
- Speedy Django Development As I’ve mentioned before, I am building my own web...
- Top ten reasons to use Django for your web framework Django is pulling ahead of every other web framework I’ve...
- First use of the Django Magic Removal Last night I took a break from my most recent...