ImportError: cannot import name

2017-12-19  本文已影响461人  字节码

django 1.10 错误:

修改django.contrib.contenttype.apps.py 即可

from .management import (
    inject_rename_contenttypes_operations,
    # update_contenttypes,
    create_contenttypes,
)

将 update_contenttypes 替换 create_contenttypes

def ready(self):
    pre_migrate.connect(inject_rename_contenttypes_operations, sender=self)
    # post_migrate.connect(update_contenttypes)
    post_migrate.connect(create_contenttypes)
    checks.register(check_generic_foreign_keys, checks.Tags.models)

将update_contenttypes 替换为 create_contenttypes

参考资料

上一篇下一篇

猜你喜欢

热点阅读