Django 管理员密码自发更改

发布于 2024-11-01 06:12:21 字数 360 浏览 5 评论 0原文

奇怪的事情发生了。我正在本地开发,并且我的管理员超级用户帐户工作了很长一段时间。

我最近只是搞乱了 Django 中的装饰器模块,但我最终没有在那里添加任何代码(我确实添加了一些,但后来我删除了所有代码)。

现在,我的管理员不再识别我的密码。我 100% 确定密码是正确的。

我在开发服务器中收到一条回溯,声称这是一个套接字错误。

C:\Python27\lib\socket.py, line 303

error: an established connection was aborted by the software in your host machine

知道这是怎么回事吗?

Something bizarre happened. I'm developing locally and I had my admin superuser account working for quite a while.

I recently just messed around with the decorators module in Django, but I ultimately didn't add any code there (i did add some, but I then deleted all of it).

Now, my admin is no longer recognizing my password. I am 100% certain that the password is correct.

I am receiving a traceback within my development server which claims that it's a Sockets error.

C:\Python27\lib\socket.py, line 303

error: an established connection was aborted by the software in your host machine

Any clue what is going on here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半仙 2024-11-08 06:12:21

从你所说的情况来看,不知道为什么会发生这种情况。但是如果您需要重置管理员密码,您可以这样做:

从 shell:

python ./manage.py shell

在 python 中:

>>> from django.contrib.auth.models import User
>>> users = User.objects.all()
>>> users
[<User: admin>, etc...]
>>> user = users[0] # 0 being the index of the User account you want,
                    # returned on the previous line
>>> user.set_password('newpass');
>>> user.save()

No idea why that might have happened, from what you've said. But if you need to reset your admin password, you can do it like this:

From shell:

python ./manage.py shell

In python:

>>> from django.contrib.auth.models import User
>>> users = User.objects.all()
>>> users
[<User: admin>, etc...]
>>> user = users[0] # 0 being the index of the User account you want,
                    # returned on the previous line
>>> user.set_password('newpass');
>>> user.save()
靑春怀旧 2024-11-08 06:12:21

如果您使用的是较新版本的 django,如果您尝试从 manage.py 更改管理员密码,会发生什么情况?

http://docs.djangoproject。 com/en/dev/ref/django-admin/?from=olddocs#django-admin-changepassword

If you are using a newer version of django, what happens if you try to change your admin password from manage.py?

http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs#django-admin-changepassword

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文