离线生成错误 - Django压缩器

时间:2017-07-28 14:09:26

标签: python django heroku django-compressor

我正在尝试通过Flynn设置Cabot,这基本上就像一个内部的heroku。 当我部署eveything并尝试运行它时,我得到了这个例外。

OfflineGenerationError: You have offline compression enabled but key "88dbbdf7c5e6ceca63a19023be40a840" is missing from offline manifest. You may need to run "python manage.py compress".

我读到here COMPRESS_ROOT的路径可能不是绝对路径,这可能是问题,但是当我检查时,我在日志中得到了这些。对我来说似乎绝对。

[2017-07-28T13:50:24.532104Z]    ('\n \n \n \n STATIC & CCOMPRESS ARE ', '/app/cabot/collectedstatic/', '\n \n \n \n ')
[2017-07-28T13:50:24.532943Z]    ('\n \n \n \n STATIC & CCOMPRESS URL ARE ', '/static/', '\n \n \n \n ')

我尝试在构建过程中运行manage.py compress并遇到以下错误。

当我运行manage.py compress

   Invalid template /app/.heroku/python/lib/python2.7/site-packages/django_filters/templates/django_filters/rest_framework/crispy_form.html: 'crispy_forms_tags' is not a registered tag library. Must be one of:
   admin_list
   admin_modify
   admin_static
   admin_urls
   cache
   compress
   extra
   i18n
   jsonify
   l10n
   log
   polymorphic_admin_tags
   polymorphic_formset_tags
   rest_framework
   static
   staticfiles
   tz
   Invalid template /app/.heroku/python/lib/python2.7/site-packages/rest_framework/templates/rest_framework/filters/django_filter_crispyforms.html: 'crispy_forms_tags' is not a registered tag library. Must be one of:
   admin_list
   admin_modify
   admin_static
   admin_urls
   cache
   compress
   extra
   i18n
   jsonify
   l10n
   log
   polymorphic_admin_tags
   polymorphic_formset_tags
   rest_framework
   static
   staticfiles
   tz
   Found 'compress' tags in:
   /tmp/build/app/cabot/templates/cabotapp/shift_list.html
   /tmp/build/app/cabot/templates/cabotapp/statuscheck_detail.html
   /tmp/build/app/cabot/templates/registration/logout.html
   /tmp/build/app/cabot/templates/cabotapp/about.html
   /tmp/build/app/cabot/templates/cabotapp/setup.html
   /tmp/build/app/cabot/templates/cabotapp/statuscheckresult_detail.html
   /tmp/build/app/cabot/templates/cabotapp/instance_list.html
   /tmp/build/app/cabot/templates/cabotapp/instance_confirm_delete.html
   /tmp/build/app/cabot/templates/cabotapp/statuscheck_report.html
   /tmp/build/app/cabot/templates/cabotapp/service_list.html
   /tmp/build/app/cabot/templates/cabotapp/instance_detail.html
   /tmp/build/app/cabot/templates/cabotapp/plugin_settings_form.html
   /tmp/build/app/cabot/templates/cabotapp/alertpluginuserdata_form.html
   /tmp/build/app/cabot/templates/registration/login.html
   /tmp/build/app/cabot/templates/cabotapp/statuscheck_list.html
   /tmp/build/app/cabot/templates/404.html
   /tmp/build/app/cabot/templates/cabotapp/instance_form.html
   /tmp/build/app/cabot/templates/cabotapp/subscriptions.html
   /tmp/build/app/cabot/templates/cabotapp/service_detail.html
   /tmp/build/app/cabot/templates/base.html
   /tmp/build/app/cabot/templates/cabotapp/statuscheck_form.html
   /tmp/build/app/cabot/templates/cabotapp/service_confirm_delete.html
   /tmp/build/app/cabot/templates/cabotapp/statuscheck_confirm_delete.html
   /tmp/build/app/cabot/templates/cabotapp/service_form.html
   Compressing... CommandError: An error occurred during rendering /tmp/build/app/cabot/templates/cabotapp/shift_list.html: /bin/sh: 1: lessc: not found

奇怪的是,如果我在我当地的码头上运行它,它运行得很好。我试图抛弃这里的docker部分并使用Procfile运行使用heroku之类的构建过程。 不确定解决方案是什么。

1 个答案:

答案 0 :(得分:0)

Docker和Heroku都有不同的基础机器。我相信你没有在Heroku上部署一个容器,而是在VM上,你在docker上进行本地测试。它们都不同。

假设两种情况下的包管理器都是apt,您应该执行命令

apt list --installed

在这两个地方,看看heroku上缺少哪些包。这将让你了解这个问题。

相关问题