Pushing Django app to heroku throws error "ImportError: No module named djangocms_history"
Pushing Django app to heroku throws error "ImportError: No module named djangocms_history"
我有一个要推送到 heroku 的 Django 项目。我的 requirements.txt 文件是
Django==1.11.18
django-cms==3.5.3
django-sekizai==0.10.0
django-treebeard==4.3
djangocms-admin-style==1.2.9
当我尝试部署到 heroku 时,出现以下错误:
remote: -----> $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 22, in <module>
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
remote: django.setup()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
remote: apps.populate(settings.INSTALLED_APPS)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
remote: app_config = AppConfig.create(entry)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
remote: module = import_module(entry)
remote: File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
remote: __import__(name)
remote: ImportError: No module named djangocms_history
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to udsa-content-repository.
remote:
To https://git.heroku.com/udsa-content-repository.git
! [remote rejected] fixing-heroku-build -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/udsa-content-repository.git'
我在激活 virtualenv
之前在我的本地尝试 运行 命令时遇到了同样的错误 ImportError: No module named djangocms_history
所以我不知道这是否与它有任何关系.有人知道如何解决这个问题吗?
- 运行
pip install djangocms-history
- 将
djangocms_history
添加到您的 INSTALLED_APPS
- 运行
python manage.py migrate djangocms_history
你有一个 ImportError
.
转到您的代码,在整个代码库中搜索 djangocms_history
然后 pip install djangocms_history
,重启你的 wsgi,然后试试看。
或者注释掉它,以及任何使用它的东西。然后再试一次运行。
根据具体情况,您可能还必须进行迁移并进行迁移。
您的 requirements.txt
文件似乎丢失了:
djangocms-history==1.0.0
我有一个要推送到 heroku 的 Django 项目。我的 requirements.txt 文件是
Django==1.11.18
django-cms==3.5.3
django-sekizai==0.10.0
django-treebeard==4.3
djangocms-admin-style==1.2.9
当我尝试部署到 heroku 时,出现以下错误:
remote: -----> $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 22, in <module>
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
remote: django.setup()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
remote: apps.populate(settings.INSTALLED_APPS)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
remote: app_config = AppConfig.create(entry)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
remote: module = import_module(entry)
remote: File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
remote: __import__(name)
remote: ImportError: No module named djangocms_history
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to udsa-content-repository.
remote:
To https://git.heroku.com/udsa-content-repository.git
! [remote rejected] fixing-heroku-build -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/udsa-content-repository.git'
我在激活 virtualenv
之前在我的本地尝试 运行 命令时遇到了同样的错误 ImportError: No module named djangocms_history
所以我不知道这是否与它有任何关系.有人知道如何解决这个问题吗?
- 运行
pip install djangocms-history
- 将
djangocms_history
添加到您的INSTALLED_APPS
- 运行
python manage.py migrate djangocms_history
你有一个 ImportError
.
转到您的代码,在整个代码库中搜索 djangocms_history
然后 pip install djangocms_history
,重启你的 wsgi,然后试试看。
或者注释掉它,以及任何使用它的东西。然后再试一次运行。
根据具体情况,您可能还必须进行迁移并进行迁移。
您的 requirements.txt
文件似乎丢失了:
djangocms-history==1.0.0