Heroku无法在git push(Python 2.7.3)上编译app,推送拒绝 - 可能是collectstatic问题

时间:2013-02-12 16:28:34

标签: python django heroku

我正在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

我认为它与python-dateutil库没有在Heroku堆栈上正确编译并且collectstatic进程失败有关。该过程仅在我作为要求添加时才开始。

具有类似输出的其他Stack Overflow帖子似乎也有同样的问题。它抱怨缺少时间模块似乎很奇怪,但可能这是下游错误?

感谢你提出任何建议!

1 个答案:

答案 0 :(得分:0)

PYTHONPATH似乎有另一个time,它优先于标准图书馆的time模块;即其他time所在的目录位于标准库的路径之前。

最简单的解决方案是重命名项目特定的time

相关问题