QingdaoU / OnlineJudgeDeploy

537 stars 371 forks source link

一不小心在后台把root账号设置为Disable了怎么办? #51

Open LisirX opened 4 years ago

LisirX commented 4 years ago

只有这一个管理员账号了 不知道怎么恢复?

LisirX commented 4 years ago

Your account has been disabled 登陆的时候提示这个

virusdefender commented 4 years ago

数据库或者 django shell 改吧

LisirX commented 4 years ago

python3 manage.py createsuperuser
Django VERSION (2, 1, 7, 'final', 0)
Username: admin
Password: 
Password (again): 

命令的时候出现这个问题

Traceback (most recent call last):
  File "manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute
    return super().execute(*args, **options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 184, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
AttributeError: 'UserManager' object has no attribute 'create_superuser'
Sentry is attempting to send 1 pending error messages
Waiting up to 10 seconds
Press Ctrl-C to quit
[2020-08-09 12:15:29] - [ERROR] - [sentry.errors:684]  - Sentry responded with an API error: RateLimited(None)
b'Sentry responded with an API error: RateLimited(None)'
[2020-08-09 12:15:29] - [ERROR] - [sentry.errors.uncaught:712]  - ["AttributeError: 'UserManager' object has no attribute 'create_superuser'", '  File "manage.py", line 12, in <module>', '  File "django/core/management/__init__.py", line 381, in execute_from_command_line', '  File "django/core/management/__init__.py", line 375, in execute', '  File "django/core/management/base.py", line 316, in run_from_argv', '  File "django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute', '  File "django/core/management/base.py", line 353, in execute', '  File "django/contrib/auth/management/commands/createsuperuser.py", line 184, in handle']
b'["AttributeError: \'UserManager\' object has no attribute \'create_superuser\'", \'  File "manage.py", line 12, in <module>\', \'  File "django/core/management/__init__.py", line 381, in execute_from_command_line\', \'  File "django/core/management/__init__.py", line 375, in execute\', \'  File "django/core/management/base.py", line 316, in run_from_argv\', \'  File "django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute\', \'  File "django/core/management/base.py", line 353, in execute\', \'  File "django/contrib/auth/management/commands/createsuperuser.py", line 184, in handle\']'

小白一枚,求解