AttributeError:“ str”对象没有属性“ _meta” / Python 3.6

时间:2019-10-17 10:38:19

标签: python django python-3.x

AttributeError的错误回溯:

 File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 327, in execute
    self.check()
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\migrate.py", line 62, in _run_checks
    issues.extend(super(Command, self)._run_checks(**kwargs))
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\checks.py", line 25, in check_admin_app
    errors.extend(site.check(app_configs))
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\sites.py", line 81, in check
    errors.extend(modeladmin.check())
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\options.py", line 117, in check
    return self.checks_class().check(self, **kwargs)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\checks.py", line 526, in check
    errors.extend(self._check_list_filter(admin_obj))
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\checks.py", line 697, in _check_list_filter
    for index, item in enumerate(obj.list_filter)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\checks.py", line 697, in <listcomp>
    for index, item in enumerate(obj.list_filter)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\checks.py", line 740, in _check_list_filter_item
    get_fields_from_path(model, field)
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\utils.py", line 500, in get_fields_from_path
    parent = get_model_from_relation(fields[-1])
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\utils.py", line 451, in get_model_from_relation
    return field.get_path_info()[-1].to_opts.model
  File "C:\Users\INUSCG\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\fields\related.py", line 723, in get_path_info
    opts = self.remote_field.model._meta
AttributeError: 'str' object has no attribute '_meta'

我在python 3.6上遇到此错误,当我迁移django项目时遇到此错误

1 个答案:

答案 0 :(得分:0)

  

IT's Django version problem   我用适当的Django版本安装了python 3.8

对我有用