ImportError:无法导入设置'LJ.settings'(是否在sys.path上?):没有名为code的模块

时间:2014-12-11 09:01:30

标签: python django mongodb django-models mongoengine

这就是我运行python manage.py runserver时的输出。我使用mongodb作为我的后端和django作为框架,使用的版本是:mongoengine 0.5.2,pymongo 2.7.2和python 2.7.3

python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 263, in fetch_command
    app_name = get_commands()[subcommand]
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 109, in get_commands
    apps = settings.INSTALLED_APPS
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 134, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'LJ.settings' (Is it on sys.path?): No module named code

1 个答案:

答案 0 :(得分:0)

您可以在设置文件中的某处导入名为code的模块。运行此命令

python LJ/settings.py

并读取stacktrace以获取发生错误的确切行。