# 进入容器内部
docker exec -it jumpserver /bin/bash
# 进入目录
cd /opt/jumpserver/apps/
# 如果遇到错误:ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
# 可以执行以下命令激活 python 环境(可能 v4 容器需要)
source /opt/py3/bin/activate
# 进入 python 环境
python manage.py shell
# 或
python3 manage.py shell
# 重置用户密码
from users.models import User
u = User.objects.get(username='admin')
u.reset_password('admin')
u.save()
# 解锁登录限制
from django.core.cache import cache
cache.delete_pattern('_LOGIN_BLOCK_*')
cache.delete_pattern('_LOGIN_LIMIT_*')
# 启用禁用的用户:
from users.models import User
User.objects.filter(username='admin').update(is_active=True)
版权属于:
cicaba
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论 (0)