Django-CMS:意外的关键字参数'providing_args'
Posted
技术标签:
【中文标题】Django-CMS:意外的关键字参数\'providing_args\'【英文标题】:Django-CMS : Unexpected keyword argument 'providing_args'Django-CMS:意外的关键字参数'providing_args' 【发布时间】:2022-01-18 15:52:35 【问题描述】:我在新服务器上安装了 vanilla django-cms。我安装了所有要求。一切都很顺利,直到我想迁移到数据库 (Postgres)。
这就是我所做的:
-
尝试重新安装并再次安装。没改。
使用 google 试图找到有同样错误的人。
尝试编辑引发错误(如下所示)的信号文件,但这意味着要全部重写,但仍然无法响应。
追溯:
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'
有人有想法吗?我错过了什么。 感谢您的宝贵时间!
【问题讨论】:
【参考方案1】:我找到了这个问题的答案。 如果您查看 Django 的文档。从 2.0 到 3.0 一直是 Django。
以前是这样的:
pizza_done = django.dispatch.Signal(providing_args = ['toppings'])
现在是:
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.
来源:https://docs.djangoproject.com/en/4.0/topics/signals/
【讨论】:
【参考方案2】:用python -m pip install -U django-cors-headers
升级django-cors-headers
可以解决这个问题。
【讨论】:
以上是关于Django-CMS:意外的关键字参数'providing_args'的主要内容,如果未能解决你的问题,请参考以下文章
Scikit 管道参数 - fit() 得到了一个意外的关键字参数“gamma”
为啥此 Django API 调用出现意外的关键字参数错误?