Receive our weekly advanced programming tips for FREE
How to reset user password in django
| 0 votes
Autor: bookkeeper
Chapter: Django

Forgot your password? No problem here is how you reset it.

1. Set django and your project path in PYTHONPATH

export PYTHONPATH=/path/to/django:/path/to/your/project/

2. Set settings for your project in DJANGO_SETTINGS_MODULE

export DJANGO_SETTINGS_MODULE=your_projects.settings

3. Call ipython or python

Import User model

from django.contrib.auth.models import User

Get the user

u = User.objects.get(username='root')

Set your password


Save the password