gpt4 book ai didi

python - Django 1.8 迁移 - "NoneType"对象没有属性 "_meta"

转载 作者:太空狗 更新时间:2023-10-30 01:21:43 27 4
gpt4 key购买 nike

尝试将项目从 Django 1.7 迁移到 1.8。在与代码错误搏斗之后,我能够运行迁移。但是,当我尝试迁移时,出现错误“'NoneType' 对象没有属性 '_meta'”

回溯中没有对我的任何应用程序的引用,所以我不确定到底该去哪里寻找错误(以及要在此处包含哪些代码,以便我可以对那些试图提供帮助的人提供更多帮助我)

这是回溯的全文

(venv)rtownley@ubuntu:~/Projects/sparrow1/NJ$ ./manage.py makemigrations
No changes detected
(venv)rtownley@ubuntu:~/Projects/sparrow1/NJ$ ./manage.py migrate
Operations to perform:
Synchronize unmigrated apps: staticfiles, editor, djcelery, messages, getty, kombu_transport_django, debug_toolbar, utils, locking, petro, tokenapi, grappelli, django_extensions, selectable
Apply all migrations: adops, taxonomy, issues, editorial, contenttypes, authors, auth, comms, membership, sessions, bento, urlalias, accounts, breaking_news, easy_thumbnails, images, admin, pages, documents, events
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states...Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 221, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/db/migrations/executor.py", line 104, in migrate
state = migration.mutate_state(state, preserve=do_run)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/db/migrations/migration.py", line 83, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 51, in state_forwards
state.reload_model(app_label, self.model_name_lower)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/db/migrations/state.py", line 97, in reload_model
related_models = get_related_models_recursive(old_model)
File "/home/rtownley/Projects/sparrow1/venv/lib/python3.4/site-packages/django/db/migrations/state.py", line 57, in get_related_models_recursive
rel_app_label, rel_model_name = rel_mod._meta.app_label, rel_mod._meta.model_name
AttributeError: 'NoneType' object has no attribute '_meta'

其他可能发挥作用的部分:-我有一个自定义处理程序,用于监听保存事件、序列化数据并在 Mongo 中创建一个相同的对象-在运行Python3.4的虚拟环境之外运行

关于去哪里寻找错误有什么想法吗?谢谢,抱歉,我还不能提供更多代码!

最佳答案

感谢 meiamsome,我弄明白了:我的一个模型与一个不再存在的模型有 ForeignKey 关系(我删除了它,Git 合并将它添加回来)。感谢大家的帮助!

关于python - Django 1.8 迁移 - "NoneType"对象没有属性 "_meta",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29549180/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com