问题描述
这是值得注意的,我使用的是,以实现与CoffeeScript的编译node.js中
经过包含迁移的更改后,运行迁移时出现以下错误
code>。解决方案进一步的戳记显示,可以通过添加 / usr /local/lib/python2.7 /:/ usr / local / lib / python2.7 / lib-dynload / 改为$ PYTHONPATH。我第一次试图在buildpack的bin / release文件中尝试这样做,但我也有一个PYTHONPATH配置变量,它显然会覆盖环境的buildpack设置(因为它可能应该)。
无论如何修复$ PYTHONPATH可以让所有的工作重新开始,但这种感觉很尴尬,就像其他事情出错的症状。希望有比我更多的Heroku知识的人可以了解一些。
It's worth noting that I'm using a custom buildpack to enable coffeescript compilation with node.js.
After a change that included a migration, I got the below error upon running the migration
Running `./manage.py migrate talent` attached to terminal... up, run.3366 Traceback (most recent call last): File "./manage.py", line 8, in <module> from django.core.management import execute_from_command_line File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 1, in <module> import collections File "/usr/local/lib/python2.7/collections.py", line 8, in <module> from _collections import deque, defaultdict ImportError: No module named _collectionsAfter poking around a bit in a heroku run bash shell session I found that the same error could be triggered by opening a python repl and running import collections.
解决方案Further poking revealed that the error could be suppressed by adding /usr/local/lib/python2.7/:/usr/local/lib/python2.7/lib-dynload/ to $PYTHONPATH. I first tried to to this in the bin/release file of the buildpack, but I also had a PYTHONPATH config variable which apparently overrides the buildpack setting of the environment (as it probably should).
Anyway fixing the $PYTHONPATH made everything work again, but this feels awkward, like a symptom that something else has gone wrong. Hopefully someone with more Heroku knowledge than me can shed some light.
这篇关于heroku django导入错误,没有名为_collections的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!