为Django用户设置密码
我正在运行Django并试图创建一个超级用户,但每当我尝试执行passwd或createsuperuser命令时,我总是会遇到以下错误。我正在PostgreSQL数据库上使用Django 1.3为Django用户设置密码,django,postgresql,Django,Postgresql,我正在运行Django并试图创建一个超级用户,但每当我尝试执行passwd或createsuperuser命令时,我总是会遇到以下错误。我正在PostgreSQL数据库上使用Django 1.3 $ python manage.py createsuperuser ... Traceback (most recent call last): File "manage.py", line 19, in <module> execute_manager(settings)
$ python manage.py createsuperuser
...
Traceback (most recent call last):
File "manage.py", line 19, in <module>
execute_manager(settings)
File "/home/stephen/.virtualenvs/s/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home/stephen/.virtualenvs/s/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/stephen/.virtualenvs/s/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/stephen/.virtualenvs/s/lib/python2.7/site-packages/django/core/management/base.py", line 229, in execute
self.stdout.write(output)
TypeError: expected a character buffer object
这是我的虚拟视频
$ pip freeze
Django==1.3
wsgiref==0.1.2
mimeparse==0.1.3
有什么想法吗?谢谢 您给出了错误的参数。你应该试试:
python manage.py createsuperuser --username=admin --email=a@dmin.com
此外:
您必须像这样调用它
python manage.py createsuperuser
或者像这样调用它python manage.py createsuperuser--username admin
。假设您已经启用了django.contrib.auth
。对不起,我只是打错了。我使用的是manage.py createsuperuser
,该命令提示我输入用户名和密码,但设置失败。尝试使用这些参数,它会提示我输入用户admin
的密码,然后抛出上述类型错误。因此,你为pasword键入什么?我尝试了与你精确的环境设置,效果很好。我觉得你的外壳有问题。有人知道发生了什么吗?这就是我现在的感觉。。。对于未来:这是我的问题(可能是OP的类似问题)
python manage.py createsuperuser --username=admin --email=a@dmin.com