Saqib Saud
Saqib Saud

Reputation: 2795

Error while deploying flask app to Heroku

I'm trying to deploy flask app to Heroku. This app is running fine locally when i run it using heroku local web

But when I try to deploy it using git push heroku master I get error

AttributeError: 'module' object has no attribute 'HTTPSConnection'

I have verified that I have proper https bindings installed

python -c "import hashlib; print dir(hashlib)"
python -c "import httplib; print dir(httplib)"
python -c "import httplib; print dir(httplib.HTTPSConnection)"

Complete log of error:-

git push heroku master
Counting objects: 29, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (29/29), 5.15 KiB | 0 bytes/s, done.
Total 29 (delta 12), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: ERROR:root:code for hash md5 was not found.
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:     globals()[__func_name] = __get_hash(__func_name)
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:     raise ValueError('unsupported hash type ' + name)
remote: ValueError: unsupported hash type md5
remote: ERROR:root:code for hash sha1 was not found.
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:     globals()[__func_name] = __get_hash(__func_name)
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:     raise ValueError('unsupported hash type ' + name)
remote: ValueError: unsupported hash type sha1
remote: ERROR:root:code for hash sha224 was not found.
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:     globals()[__func_name] = __get_hash(__func_name)
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:     raise ValueError('unsupported hash type ' + name)
remote: ValueError: unsupported hash type sha224
remote: ERROR:root:code for hash sha256 was not found.
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:     globals()[__func_name] = __get_hash(__func_name)
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:     raise ValueError('unsupported hash type ' + name)
remote: ValueError: unsupported hash type sha256
remote: ERROR:root:code for hash sha384 was not found.
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:     globals()[__func_name] = __get_hash(__func_name)
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:     raise ValueError('unsupported hash type ' + name)
remote: ValueError: unsupported hash type sha384
remote: ERROR:root:code for hash sha512 was not found.
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:     globals()[__func_name] = __get_hash(__func_name)
remote:   File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:     raise ValueError('unsupported hash type ' + name)
remote: ValueError: unsupported hash type sha512
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/bin/pip", line 9, in <module>
remote:     load_entry_point('pip==1.3.1', 'console_scripts', 'pip')()
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 343, in load_entry_point
remote:     return get_distribution(dist).load_entry_point(group, name)
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 2309, in load_entry_point
remote:     return ep.load()
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 2015, in load
remote:     entry = __import__(self.module_name, globals(),globals(), ['__name__'])
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/__init__.py", line 11, in <module>
remote:     from pip.vcs import git, mercurial, subversion, bazaar  # noqa
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/vcs/mercurial.py", line 9, in <module>
remote:     from pip.download import path_to_url2
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/download.py", line 72, in <module>
remote:     class VerifiedHTTPSConnection(httplib.HTTPSConnection):
remote: AttributeError: 'module' object has no attribute 'HTTPSConnection'
remote:      $ pip install -r requirements.txt
remote:        ERROR:root:code for hash md5 was not found.
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:            globals()[__func_name] = __get_hash(__func_name)
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:            raise ValueError('unsupported hash type ' + name)
remote:        ValueError: unsupported hash type md5
remote:        ERROR:root:code for hash sha1 was not found.
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:            globals()[__func_name] = __get_hash(__func_name)
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:            raise ValueError('unsupported hash type ' + name)
remote:        ValueError: unsupported hash type sha1
remote:        ERROR:root:code for hash sha224 was not found.
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:            globals()[__func_name] = __get_hash(__func_name)
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:            raise ValueError('unsupported hash type ' + name)
remote:        ValueError: unsupported hash type sha224
remote:        ERROR:root:code for hash sha256 was not found.
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:            globals()[__func_name] = __get_hash(__func_name)
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:            raise ValueError('unsupported hash type ' + name)
remote:        ValueError: unsupported hash type sha256
remote:        ERROR:root:code for hash sha384 was not found.
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:            globals()[__func_name] = __get_hash(__func_name)
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:            raise ValueError('unsupported hash type ' + name)
remote:        ValueError: unsupported hash type sha384
remote:        ERROR:root:code for hash sha512 was not found.
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 139, in <module>
remote:            globals()[__func_name] = __get_hash(__func_name)
remote:          File "/app/.heroku/python/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
remote:            raise ValueError('unsupported hash type ' + name)
remote:        ValueError: unsupported hash type sha512
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/bin/pip", line 9, in <module>
remote:            load_entry_point('pip==1.3.1', 'console_scripts', 'pip')()
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 343, in load_entry_point
remote:            return get_distribution(dist).load_entry_point(group, name)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 2309, in load_entry_point
remote:            return ep.load()
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 2015, in load
remote:            entry = __import__(self.module_name, globals(),globals(), ['__name__'])
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/__init__.py", line 11, in <module>
remote:            from pip.vcs import git, mercurial, subversion, bazaar  # noqa
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/vcs/mercurial.py", line 9, in <module>
remote:            from pip.download import path_to_url2
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/download.py", line 72, in <module>
remote:            class VerifiedHTTPSConnection(httplib.HTTPSConnection):
remote:        AttributeError: 'module' object has no attribute 'HTTPSConnection'
remote: 
remote:  !     Push rejected, failed to compile Python app

Upvotes: 4

Views: 591

Answers (1)

Saqib Saud
Saqib Saud

Reputation: 2795

This error is being generated by the heroku. It turns out that I was not using right configuration for building app. some how I missed runtime.txt file, which contains the following text.

python-2.7.11

Upvotes: 6

Related Questions