Django-CMS:意外的关键字参数“providing_args”

Sne*_*eil 6 django django-cms python-3.x

我在新服务器上安装了普通的 django-cms。我安装了所有要求。一切都很顺利,直到我想迁移到数据库(Postgres)。

这就是我所做的:

  1. 尝试重新安装并再次安装。没有改变它。
  2. 使用谷歌尝试找到有相同错误的人。
  3. 尝试编辑引发错误(如下所示)的信号文件,但这意味着将其全部重写,这仍然使其无响应。

追溯:

  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/websites/fl/flvenv/lib/python3.8/site-packages/django/core/management/_                                                                                                                                                             _init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/websites/fl/flvenv/lib/python3.8/site-packages/django/core/management/_                                                                                                                                                             _init__.py", line 401, in execute
    django.setup()
  File "/websites/fl/flvenv/lib/python3.8/site-packages/django/__init__.py", lin                                                                                                                                                             e 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/websites/fl/flvenv/lib/python3.8/site-packages/django/apps/registry.py"                                                                                                                                                             , line 114, in populate
    app_config.import_models()
  File "/websites/fl/flvenv/lib/python3.8/site-packages/django/apps/config.py",                                                                                                                                                              line 300, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/websites/fl/flvenv/lib/python3.8/site-packages/cms/models/__init__.py",                                                                                                                                                              line 12, in <module>
    from cms import signals as s_import  # nopyflakes
  File "/websites/fl/flvenv/lib/python3.8/site-packages/cms/signals/__init__.py"                                                                                                                                                             , line 16, in <module>
    page_moved = Signal(providing_args=["instance"])
TypeError: __init__() got an unexpected keyword argument 'providing_args'
Run Code Online (Sandbox Code Playgroud)

有人有主意吗?我错过了什么。谢谢你的时间!

Sne*_*eil 4

我找到了这个问题的答案。如果你看一下 Django 的文档。从2.0到3.0一直是Django。

以前做的是:

pizza_done = django.dispatch.Signal(providing_args = ['toppings'])
Run Code Online (Sandbox Code Playgroud)

现在它是:

Defining signals

All signals are django.dispatch.Signal instances.

For example:

import django.dispatch

pizza_done = django.dispatch.Signal()
This declares a pizza_done signal.
Run Code Online (Sandbox Code Playgroud)

来源: https: //docs.djangoproject.com/en/4.0/topics/signals/