我尝试在python(python 2.7.10)中部署Flask应用程序。 这是一个非常简单的app.txt应用程序
该应用在本地工作。 我现在尝试在IBM Bluemix上部署它并在粘贴命令
之后sudo cf push app
sudo cf logs predict_population --recent
我有这个错误:
ERR Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bPyipf/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RwvTnr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-bPyipf/distribute/ 2016-09-11T14:09:39.93+0300
[STG/0] ERR Traceback (most recent call last): 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/bin/pip", line 9, in <module> 2016-09-11T14:09:39.93+0300
[STG/0] ERR load_entry_point('pip==8.1.1', 'console_scripts', 'pip')() 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/__init__.py", line 217, in main 2016-09-11T14:09:39.93+0300
[STG/0] ERR return command.main(cmd_args) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 246, in main 2016-09-11T14:09:39.93+0300
[STG/0] ERR pip_version_check(session) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/outdated.py", line 102, in pip_version_check 2016-09-11T14:09:39.93+0300
[STG/0] ERR installed_version = get_installed_version("pip") 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/__init__.py", line 848, in get_installed_version 2016-09-11T14:09:39.93+0300
[STG/0] ERR working_set = pkg_resources.WorkingSet() 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 626, in __init__ 2016-09-11T14:09:39.93+0300
[STG/0] ERR self.add_entry(entry) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 682, in add_entry 2016-09-11T14:09:39.93+0300
[STG/0] ERR for dist in find_distributions(entry, True): 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2080, in find_eggs_in_zip 2016-09-11T14:09:39.93+0300
[STG/0] ERR if metadata.has_metadata('PKG-INFO'): 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1610, in has_metadata 2016-09-11T14:09:39.93+0300
[STG/0] ERR return self.egg_info and self._has(self._fn(self.egg_info, name)) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1968, in _has 2016-09-11T14:09:39.93+0300
[STG/0] ERR return zip_path in self.zipinfo or zip_path in self._index() 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1848, in zipinfo 2016-09-11T14:09:39.93+0300
[STG/0] ERR return self._zip_manifests.load(self.loader.archive) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1791, in load 2016-09-11T14:09:39.93+0300
[STG/0] ERR manifest = self.build(path) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1764, in build 2016-09-11T14:09:39.93+0300
[STG/0] ERR with ContextualZipFile(path) as zfile: 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 1813, in __new__ 2016-09-11T14:09:39.93+0300
[STG/0] ERR return zipfile.ZipFile(*args, **kwargs) 2016-09-11T14:09:39.93+0300
[STG/0] ERR File "/app/.heroku/python/lib/python2.7/zipfile.py", line 756, in __init__ 2016-09-11T14:09:39.94+0300
[STG/0] ERR self.fp = open(file, modeDict[mode]) 2016-09-11T14:09:39.94+0300
[STG/0] ERR IOError: [Errno 21] Is a directory: '/app/.heroku/python/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg'
答案 0 :(得分:0)
解决了!如果名称==&#34;:app.run(),请执行port = os.getenv(&#39; PORT&#39;,PORT_NUMBER),如果名称==&#34;主要&# 34;:app.run(host =&#39; 0.0.0.0&#39;,port = int(port)),它有效!