将flask应用程序部署到Heroku时出错

时间:2016-07-05 06:51:56

标签: python heroku flask

我试图将烧瓶应用程序部署到Heroku。当我使用heroku local web

运行时,此应用在本地运行正常

但是当我尝试使用git push heroku master部署它时,我收到错误

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

我已经确认我安装了正确的https绑定

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

完成错误记录: -

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

1 个答案:

答案 0 :(得分:6)

heroku正在生成此错误。事实证明,我没有使用正确的配置来构建应用程序。一些我错过m.key = 'poo'文件的方法,其中包含以下文字。

runtime.txt