简体   繁体   中英

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.

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:

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. 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. 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; ie the directory in which the other time resides is ahead of the path to the Standard Library.

The simplest solution is to rename the project-specific time .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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