gpt4 book ai didi

django - ImportError:没有名为模型的模块?

转载 作者:行者123 更新时间:2023-12-01 23:03:04 30 4
gpt4 key购买 nike

我正在使用 Django,并且我的组应用程序不断收到此错误,我检查了所有导入设置,一切都很好。我的注册和个人资料应用程序运行顺利,但为什么这个应用程序给我一个 ImportError 模型?

Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 219, in execute
self.validate()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py", line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py", line 146, in get_app_errors
self._populate()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/gladiator/django_projects/classes/groups/models.py", line 6, in <module>
from groups.shortcuts import build_filename
File "/home/gladiator/django_projects/classes/groups/groups.py", line 5, in <module>
File "/home/gladiator/django_projects/classes/groups/decorators.py", line 2, in <module>
from groups.models import Group, GroupMember
ImportError: No module named models

最佳答案

因为它认为你指的是 groups.py在同一目录中。 Enable absolute imports .

关于django - ImportError:没有名为模型的模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6772937/

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