簡體   English   中英

Django Suit:ImportError:沒有名為suit的模塊

[英]Django Suit: ImportError: No module named suit

有什么建議? 在安裝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

問題已修復。 我在 requirements.txt 中添加了 django-suit==0.2.7

如果有人遇到同樣的問題並在 requrements.txt 中添加“django-suit==0.2.7”行不起作用,那么請嘗試在 requirements.txt 文件中添加最新的 django-suite 版本名稱並它應該工作。

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

    django-suit==0.2.13

然后運行以下命令。

    pip install -r requirements.txt

現在,它應該可以工作了!! ;)

不要忘記 make migrate: python manage.py migrate

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM