gpt4 book ai didi

python - ImportError : Could not import settings 'settings.py' (Is it on sys. path?): No module named py

转载 作者:太空宇宙 更新时间:2023-11-04 07:03:06 25 4
gpt4 key购买 nike

Shis 是我尝试使用以下命令从 django.contrib.gis.db 导入模型时遇到的错误

from django.contrib.gis.db import models

我想这样做来定义地理模型。我收到以下提到的错误。

伙计们请帮帮我。

from django.contrib.gis.db import models
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/django/contrib/gis/db/models/__init__.py", line 2, in <module>
from django.db.models import *
File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 11, in <module>
if DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 184, in inner
self._setup()
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings.py' (Is it on sys.path?): No module named py

这是我在终端中获得的完整回溯。

最佳答案

您正在执行 import settings.py 而不是 import settings

关于python - ImportError : Could not import settings 'settings.py' (Is it on sys. path?): No module named py,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11010646/

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