将Django应用程序推送到heroku会抛出错误“ImportError:没有名为djangocms_history的模块”

问题描述 投票:0回答:3

我有一个Django项目,我试图推送到heroku。我的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'

在我激活ImportError: No module named djangocms_history之前尝试在我的本地运行命令时,我得到了相同的错误virtualenv所以我不知道这是否与它有任何关系。有人知道怎么修这个东西吗?

python django python-2.7 heroku virtualenv
3个回答
1
投票

您的requirements.txt文件似乎丢失了:

djangocms-history==1.0.0

1
投票
  • 运行pip install djangocms-history
  • djangocms_history添加到你的INSTALLED_APPS
  • 运行python manage.py migrate djangocms_history

1
投票

你有一个ImportError

ImportError for python2.

转到您的代码,搜索整个代码库以获取djangocms_history

然后要么pip install djangocms_history,重新启动你的wsgi,然后尝试一下。

或者评论它,以及使用它的任何东西。然后再试一次。

根据具体情况,您可能还必须进行迁移和迁移。

© www.soinside.com 2019 - 2024. All rights reserved.