简体   繁体   English

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

[英]Heroku failing to compile app on git push (Python 2.7.3), push rejected - possibly collectstatic issue

I'm running a Python app (2.7.3) on Heroku and upon pushing the code via git, the deploy fails. 我在Heroku上运行Python应用程序(2.7.3),并通过git推送代码后,部署失败。

Here is the traceback: 这是回溯:

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

Here is the relevant output from the Heroku logs: 这是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

I believe it has something to do with the python-dateutil library not being correctly compiled on the Heroku stack and the collectstatic process failing. 我相信这与python-dateutil库没有在Heroku堆栈上正确编译以及collectstatic进程失败有关。 The process only began when I added in this as a requirement. 仅当我将此添加为要求时,该过程才开始。

Other Stack Overflow posts with similar output seem to have the same issue. 具有类似输出的其他Stack Overflow帖子似乎也有相同的问题。 It seems odd that it complains about the lack of the time module, but presumably this is a downstream error? 它抱怨缺少时间模块似乎很奇怪,但是大概这是一个下游错误吗?

Thanks for any suggestions you may have! 感谢您的任何建议!

It appears that there is another time in the PYTHONPATH which is taking precedence over the Standard Library's time module; 似乎PYTHONPATH中还有另一个time优先于标准库的time模块。 ie the directory in which the other time resides is ahead of the path to the Standard Library. 即,其他time所在的目录位于标准库路径的前面。

The simplest solution is to rename the project-specific time . 最简单的解决方案是重命名项目特定的time

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM