简体   繁体   中英

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

Shis is the error I am getting while I'm trying to import models from django.contrib.gis.db using following command

from django.contrib.gis.db import models

I want to do this to define geographic model. I am getting the below mentioned error.

Guys plz help me out.

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

This is the full traceback I'm getting in the terminal.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM