无法在OpenShift上的Django中创建超级用户

时间:2018-07-14 23:55:04

标签: django python-3.x openshift openshift-origin openshift-client-tools

我正在尝试在OpenShift上设置Django应用。 尝试创建超级用户,输入用户名,电子邮件和密码后,出现以下错误:

TypeError: object supporting the buffer API required

是否缺少某些包装?我做错什么了吗?
django版本2.0.7
python版本3.6.3

完整错误消息:

(app-root) sh-4.2$ python manage.py createsuperuser
Username: maciej
Email address: xxx@xxx
Password:
Password (again):
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute
    return super().execute(*args, **options)
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 179, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/models.py", line 161, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/models.py", line 143, in _create_user
    user.set_password(password)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 98, in set_password
    self.password = make_password(raw_password)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/hashers.py", line 80, in make_password
    return hasher.encode(password, salt)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/hashers.py", line 249, in encode
    hash = pbkdf2(password, salt, iterations, digest=self.digest)
  File "/opt/app-root/lib/python3.6/site-packages/django/utils/crypto.py", line 85, in pbkdf2
    return hashlib.pbkdf2_hmac(digest().name, password, salt, iterations, dklen)
  File "/opt/app-root/lib64/python3.6/hashlib.py", line 90, in inner
    return func(*args, **kwargs)
TypeError: object supporting the buffer API required

1 个答案:

答案 0 :(得分:0)

感谢Graham Gordon向我指出了这个问题: github.com/sclorg/s2i-python-container/issues/237

就我而言,最简单的解决方法是将Python 3.6映像更改为Python 3.5。可以通过OpenShift的网络控制台完成:

内部版本->选择相关内部版本->操作->编辑->图像配置