AttributeError:'Meta'对象没有属性'app_config'

时间:2017-10-23 09:17:47

标签: python django

我正在尝试从git repo运行本地计算机上已有的项目。尝试运行命令“python manage.py runserver”会产生AttributeError

错误在第81行:

def check(self, app_configs):

    if app_configs is None:
        app_configs = apps.get_app_configs()
    app_configs = set(app_configs)  # Speed up lookups below

    errors = []
    modeladmins = (o for o in self._registry.values() if o.__class__ is not ModelAdmin)
    for modeladmin in modeladmins:
        if modeladmin.model._meta.app_config in app_configs: #ErrorHere
            errors.extend(modeladmin.check())
    return errors

命令提示错误

Unhandled exception in thread started by <function wrapper at 0x0000000005D14128>
Traceback (most recent call last):
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\core\management\base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\contrib\admin\checks.py", line 25, in check_admin_app
    errors.extend(site.check(app_configs))
  File "C:\Users\osola\Anaconda2\lib\site-packages\django\contrib\admin\sites.py", line 80, in check
    if modeladmin.model._meta.app_config in app_configs:
AttributeError: 'Meta' object has no attribute 'app_config'

0 个答案:

没有答案