python - Django/Python - ImportError : Could not import settings 'twitter.settings' (Is it on sys. 路径?):没有名为设置的模块

标签 python django settings importerror python-twitter

我最近开始了我的第一个 Django 项目。我以前能够运行命令“python manage.py runserver”而不返回任何错误,但现在它返回一条长错误消息,我无法解决...

 File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 8, in <module>
    from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 26, in <module>
    from django.views import static
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/views/static.py", line 95, in <module>
    template_translatable = ugettext_noop(u"Index of %(directory)s")
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
    return _trans.gettext_noop(message)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
    if settings.USE_I18N:
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
    self._setup()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-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 'twitter.settings' (Is it on sys.path?): No module named settings

我不确定为什么会返回此错误。我能想到的唯一可能影响它的是我最近下载并安装了 python-twitter 库,因为我在项目中使用 Twitter API。任何有关如何解决此问题的帮助将非常感激!

谢谢

杰西

最佳答案

我不熟悉 python-twitter 库,但我猜测该模块名为 twitter。因此,您可能尝试从 python-twitter 库中提取一个名为“settings”的属性。您可能想要更改项目名称。

关于python - Django/Python - ImportError : Could not import settings 'twitter.settings' (Is it on sys. 路径?):没有名为设置的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11922851/

相关文章:

python - 从架构中不存在的 JSON 对象中删除属性?

django - 如何使用 Django ModelForm 生成下拉输入?

python - 用于显示 Django 版本的 Django 模板标签

python - 如何让 python.vim 与 vim 一起工作?

c# - 在应用程序设置中存储 Dictionary<string,string>

merge - 桌面桥 - 升级设置不起作用

python - python数据框中的新向量创建

python - Spark结构化流: parquet partition name uniqueness

python - 在 matplotlib 中调整图形质量

python - 在 Django 中处理 memcache 缓存的模式