Я пытаюсь загрузить веб-сервис, разработанный на python с использованием библиотеки Flask, в IBM Cloud с помощью IBM CLI.Когда веб-служба запускается в облаке, она ожидает своего запуска «Ожидание запуска приложения ...», пока не появится сообщение «Запуск не выполнен» и ошибка FAILED.Ниже я помещаю все полученные из логов при работе с этим приложением
app.py
#!flask/bin/python
from flask import Flask, request, jsonify
from pymongo import MongoClient
from datetime import datetime
import os
app = Flask(__name__)
# On Bluemix, get the port number from the environment variable PORT
# When running this app on the local machine, default the port to 8000
port = int(os.getenv('PORT', 8000))
###################### /API ENDPOINTS ##############################
if __name__ == '__main__':
app.run(host='0.0.0.0', port=port, debug=True, threaded=True)
Procfile
web: python app.py
needs.txt
Flask==0.12.1
pymongo==3.7.2
Я уже попробовал использовать файл require.txt
Flask==1.0.2
pymongo==3.7.2
setup.py
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath( path.dirname( __file__ ) )
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='app-name',
version='1.0.0',
description='First flask web service',
long_description=long_description,
url='',
license='Apache-2.0'
)
Ошибка в файле журнала:
2019-05-16T17:14:06.98-0600 [STG/0] OUT Installing collected packages: MarkupSafe, Jinja2, Werkzeug, click, itsdangerous, Flask, pymongo
2019-05-16T17:14:07.93-0600 [STG/0] OUT Successfully installed Flask-0.12.1 Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.0 itsdangerous-1.1.0 pymongo-3.7.2
2019-05-16T17:14:08.14-0600 [STG/0] ERR You are using pip version 9.0.3, however version 19.1.1 is available.
2019-05-16T17:14:08.14-0600 [STG/0] ERR You should consider upgrading via the 'pip install --upgrade pip' command.
2019-05-16T17:14:23.14-0600 [STG/0] OUT Exit status 0
2019-05-16T17:14:23.14-0600 [STG/0] OUT Uploading droplet, build artifacts cache...
2019-05-16T17:14:23.14-0600 [STG/0] OUT Uploading droplet...
2019-05-16T17:14:23.14-0600 [STG/0] OUT Uploading build artifacts cache...
2019-05-16T17:14:23.89-0600 [API/11] OUT Creating droplet for app with guid eeca8680-0347-4fc4-9c18-2b7576616234
2019-05-16T17:14:24.07-0600 [STG/0] OUT Uploaded build artifacts cache (33.1M)
2019-05-16T17:14:28.05-0600 [STG/0] OUT Uploaded droplet (34.9M)
2019-05-16T17:14:28.06-0600 [STG/0] OUT Uploading complete
2019-05-16T17:14:28.85-0600 [STG/0] OUT Cell a4f5548f-f92e-4c73-9bff-ec12545dd5b3 stopping instance 42d8c7ac-a894-4dc8-8280-8a6432c9c4f1
2019-05-16T17:14:28.85-0600 [STG/0] OUT Cell a4f5548f-f92e-4c73-9bff-ec12545dd5b3 destroying container for instance 42d8c7ac-a894-4dc8-8280-8a6432c9c4f1
2019-05-16T17:14:30.33-0600 [CELL/0] OUT Cell ff070f2e-7593-45a0-8685-9c270aedfe81 creating container for instance da48fb2e-4bf0-4d55-4f60-e021
2019-05-16T17:14:30.66-0600 [STG/0] OUT Cell a4f5548f-f92e-4c73-9bff-ec12545dd5b3 successfully destroyed container for instance 42d8c7ac-a894-4dc8-8280-8a6432c9c4f1
2019-05-16T17:14:33.65-0600 [CELL/0] OUT Cell ff070f2e-7593-45a0-8685-9c270aedfe81 successfully created container for instance da48fb2e-4bf0-4d55-4f60-e021
2019-05-16T17:14:38.26-0600 [CELL/0] OUT Starting health monitoring of container
2019-05-16T17:14:41.14-0600 [APP/PROC/WEB/0] ERR * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
2019-05-16T17:14:41.14-0600 [APP/PROC/WEB/0] ERR * Restarting with stat
2019-05-16T17:14:41.15-0600 [APP/PROC/WEB/0] ERR Traceback (most recent call last):
2019-05-16T17:14:41.15-0600 [APP/PROC/WEB/0] ERR File "app.py", line 227, in <module>
2019-05-16T17:14:41.15-0600 [APP/PROC/WEB/0] ERR app.run(host='0.0.0.0', port=port, debug=True, threaded=True)
2019-05-16T17:14:41.15-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/site-packages/flask/app.py", line 841, in run
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR run_simple(host, port, self, **options)
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/site-packages/werkzeug/serving.py", line 1007, in run_simple
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR sys.exit(reloader.restart_with_reloader())
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR exit_code = subprocess.call(args, env=new_environ, close_fds=False)
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/subprocess.py", line 172, in call
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR return Popen(*popenargs, **kwargs).wait()
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/subprocess.py", line 394, in __init__
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR errread, errwrite)
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR File "/home/vcap/deps/0/python/lib/python2.7/subprocess.py", line 1047, in _execute_child
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR raise child_exception
2019-05-16T17:14:41.16-0600 [APP/PROC/WEB/0] ERR OSError: [Errno 2] No such file or directory
2019-05-16T17:14:41.33-0600 [APP/PROC/WEB/0] OUT Exit status 1
2019-05-16T17:14:41.35-0600 [CELL/SSHD/0] OUT Exit status 0
2019-05-16T17:14:47.56-0600 [API/8] OUT Process has crashed with type: "web"
2019-05-16T17:14:47.59-0600 [API/8] OUT App instance exited with guid eeca8680-0347-4fc4-9c18-2b7576616234 payload: {"instance"=>"da48fb2e-4bf0-4d55-4f60-e021", "index"=>0, "cell_id"=>"f
f070f2e-7593-45a0-8685-9c270aedfe81", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1558048487492260855, "version"=>"c4
982556-7c37-40bf-972b-03f8b9cde9da"}