当我开始编码时突然发生的测试时,我找不到异常的解决方案。该网站仍然可以正常工作runserver
。这是完整的回溯:
Traceback (most recent call last):
File "manage.py", line 10, in <module
execute_from_command_line(sys.argv)
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 72, in handle
failures = test_runner.run_tests(test_labels)
File "…/lib/python3.5/site-packages/django/test/runner.py", line 549, in run_tests
old_config = self.setup_databases()
File "…/lib/python3.5/site-packages/django/test/runner.py", line 499, in setup_databases
self.parallel, **kwargs
File "…/lib/python3.5/site-packages/django/test/runner.py", line 743, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 78, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 122, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "…/lib/python3.5/site-packages/django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "…/lib/python3.5/site-packages/django/core/serializers/base.py", line 88, in serialize
self.handle_field(obj, field)
File "…/lib/python3.5/site-packages/django/core/serializers/python.py", line 55, in handle_field
self._current[field.name] = field.value_to_string(obj)
File "…/lib/python3.5/site-packages/markitup/fields.py", line 103, in value_to_string
return value.raw
AttributeError: 'str' object has no attribute 'raw'
通常我会尝试自己缩小问题的范围。但在这种情况下,我无处可去。
我没有更新任何软件包。这些是有问题的软件包:
- 姜戈 (1.10.7)
- django-markitup (3.0.0)
(当我用 .MarkupField
中的标准TextField
替换my 时,异常消失models.py
。)
更新:--keepdb
我连续使用时出现错误。