Django-CMS:意外的关键字参数 'providing_args'
Django-CMS : Unexpected keyword argument 'providing_args'
我在新服务器上安装了一个普通的 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'
有人知道吗?我错过了什么。
感谢您的宝贵时间!
我找到了这个问题的答案。
如果您查看 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.
用 python -m pip install -U django-cors-headers
升级 django-cors-headers
解决了这个问题。
我在新服务器上安装了一个普通的 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'
有人知道吗?我错过了什么。 感谢您的宝贵时间!
我找到了这个问题的答案。 如果您查看 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.
用 python -m pip install -U django-cors-headers
升级 django-cors-headers
解决了这个问题。