我正在开发一个扫描用户gmail收件箱并提供报告的项目.我已经在heroku中部署了以下规范:
语言:Python 2.7
框架:Django 1.8
任务调度程序:Celery(Rabbitmq-bigwig for broker url)
现在当heroku执行它时,芹菜没有给我输出.在Heroku推动其显示Collectstatic配置错误.我尝试过使用whitenoise包
还尝试执行:heroku运行python manage.py collectstatic --dry-run --noinput 仍然得到相同的错误.
$ heroku运行python manage.py collectstatic --noinput给出了错误的以下细节.
File "manage.py", line 10, inexecute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute settings.INSTALLED_APPS File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__ self._setup(name) File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/app/salesblocker/__init__.py", line 5, in from .celery import app as celery_app File "/app/salesblocker/celery.py", line 5, in from celery import Celery File "/app/.heroku/python/lib/python2.7/site-packages/celery/__init__.py", line 131, in from celery import five # noqa File "/app/.heroku/python/lib/python2.7/site-packages/celery/five.py", line 153, in from kombu.utils.compat import OrderedDict # noqa File "/app/.heroku/python/lib/python2.7/site-packages/kombu/utils/__init__.py", line 19, in from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random ImportError: cannot import name _uuid_generate_random
我还试图将heroku提交回滚到之前的工作提交并克隆该代码,但是在下次提交时(更改:从媒体文件夹中删除了媒体图像)它再次显示相同的错误.
提前致谢
您遇到此问题,这会影响Python 2.7.11(Celery需要Kombu).
该问题已在Kombu 3.0.30中修复.
虽然升级kombu是理想的选择,但如果您遇到不允许这种情况的较旧的依赖项,那么将它置于我的settings.py顶部对我有用:
import uuid uuid._uuid_generate_random = None
这是有效的,因为此处删除了 _uuid_generate_random ,这只是恢复默认值.这个hack似乎是合理的,因为Kombu只检查这个来解决2007年解决的bug,如果你因为最近的Python更新需要这个修复,你本身就不会受到影响:)