How to reset Django admin password?

前端 未结 21 1816
遥遥无期
遥遥无期 2020-12-12 08:39

I am using Django (version 1.3) and have forgotten both admin username and password. How to reset both?

And is it possible to make a normal user into admin, and then

21条回答
  •  伪装坚强ぢ
    2020-12-12 09:35

    You may also have answered a setup question wrong and have zero staff members. In which case head to postgres:

    obvioustest=# \c [yourdatabasename]
    obvioustest=# \x
    obvioustest=# select * from auth_user;
    -[ RECORD 1 ]+-------------
    id           | 1
    is_superuser | f
    is_staff     | f
    ...
    

    To fix, edit directly:

    update auth_user set is_staff='true' where id=1;
    

提交回复
热议问题