试图在heroku上创建超级用户,但它向我抛出了一个typeError。

我试着用这个命令来创建超级用户,使用这个命令。

"heroku run python manage.py createsuperuser"

但它总是向我抛出这个错误

Running python manage.py createsuperuser on ⬢ django-blog-web-app... up, run.4727 (Free)enter code here
Username (leave blank to use 'u10279'): ######################
Email address: #######################
Password:
Password (again):
'Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
    return super().execute(*args, **options)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 189, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/models.py", line 158, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/models.py", line 141, in _create_user
    user.save(using=self._db)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 66, in save
    super().save(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py", line 745, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py", line 793, in save_base
    post_save.send(
  File "/app/.heroku/python/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 173, in send
    return [
  File "/app/.heroku/python/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 174, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/app/Users/signals.py", line 10, in create_profile
    Profile.objects.create(user=instance)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/query.py", line 433, in create
    obj.save(force_insert=True, using=self.db)
TypeError: save() got an unexpected keyword argument 'force_insert'

我按照这个 教程 在heroku.com上部署我的项目。

试着非常努力地找到一个解决方案,我的问题在互联网上没有任何

请帮助…

解决方案:

我想这对你来说也不应该在本地运行。如果你的模型已经覆盖了 save 方法,请检查你是否总是将*args和**kwargs传递给重载方法。

请注意,异常是在一个信号中引发的,在一行 Profile.objects.create(user=instance).

给TA打赏
共{{data.count}}人
人已打赏
未分类

Paypal P2P支付API

2022-9-9 14:29:41

未分类

rails6从vanilla js请求中接收js.erb响应。

2022-9-9 14:29:43

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索