【问题标题】:Django Suit: ImportError: No module named suitDjango 套装:ImportError:没有名为套装的模块
【发布时间】:2014-03-24 06:42:13
【问题描述】:

有什么建议吗? 安装pip install django-suit./manage.py collectstatic 后,我在settings.py 中添加了此代码。不确定错误。

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP

TEMPLATE_CONTEXT_PROCESSORS = TCP + (
    'django.core.context_processors.request',
)

# Application definition

INSTALLED_APPS = (
    'suit',)

**error**
heroku run ./manage.py syncdb 
Running `./manage.py syncdb` attached to terminal... up, run.8285
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
    translation.activate('en-us')
  File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
    return _trans.activate(language)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
    _active.value = translation(language)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
    app = import_module(appname)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
ImportError: No module named suit

【问题讨论】:

  • 你添加到INSTALLED_APPS了吗?
  • 是的,我已将套装添加到已安装的应用程序 Rohan。
  • 根据我理解的错误应该添加“西装”。我已将其添加到 settings.py 中“django.contrib.admin”上方的 installed_apps。在我安装 pip install django-suit 后不久
  • 我通过在 requirements.txt 中添加 django-suit==0.2.7 来修复它。希望对某人有所帮助。问候,Rads

标签: django django-suit


【解决方案1】:

问题已解决。我在 requirements.txt 中添加了 django-suit==0.2.7

【讨论】:

    【解决方案2】:

    如果有人遇到同样的问题,在 requrements.txt 中添加“django-suit==0.2.7”行不起作用,请尝试在需求中添加最新的 django-suite 版本名称。 txt 文件,它应该可以工作。

    因此,您的 requirements.txt 文件将包含以下行。

        django-suit==0.2.13
    

    然后运行以下命令。

        pip install -r requirements.txt
    

    现在,它应该可以工作了!! ;)

    【讨论】:

      【解决方案3】:

      别忘了做迁移: python manage.py 迁移

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-01-21
        • 1970-01-01
        • 2016-12-07
        • 2012-10-21
        • 1970-01-01
        • 2015-12-22
        • 2015-10-04
        • 2019-06-24
        相关资源
        最近更新 更多