我在 Heroku 上运行 Python 应用程序(2.7.3),通过 git 推送代码后,部署失败。
这是回溯:
Counting objects: 139, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (102/102), done.
Writing objects: 100% (102/102), 13.47 KiB, done.
Total 102 (delta 79), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Using Python runtime (python-2.7.3)
-----> Noticed pylibmc. Bootstrapping libmemcached.
-----> Installing dependencies using Pip (1.2.1)
Downloading/unpacking python-dateutil==1.5 (from -r requirements.txt (line 9))
Running setup.py egg_info for package python-dateutil
Installing collected packages: python-dateutil
Running setup.py install for python-dateutil
Successfully installed python-dateutil
Cleaning up...
-----> Running post-compile hook
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management /__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 70, in load_command_class
return module.Command()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 57, in __init__
self.storage.path('')
File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
self._setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 279, in _setup
self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
File "/app/whoy/utils/storage.py", line 87, in __init__
self.final_storage = PublicImmutableS3Storage(location=settings.STATICFILES_S3_PREFIX)
File "/app/whoy/utils/storage.py", line 28, in __init__
'Expires': http_date(time.time() + 60*60*24*365*15),
AttributeError: 'module' object has no attribute 'time'
! Heroku push rejected, failed to compile Python app
以下是 Heroku 日志的相关输出:
2013-02-12T15:18:45+00:00 heroku[slugc]: Slug compilation started
2013-02-12T15:18:54+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
我相信这与没有在 Heroku 堆栈上正确编译的 python-dateutil 库和 collectstatic 进程失败有关。该过程仅在我将其作为要求添加时才开始。
其他具有类似输出的 Stack Overflow 帖子似乎也有同样的问题。它抱怨缺少时间模块似乎很奇怪,但大概这是一个下游错误?
感谢您提出的任何建议!