Я работаю в веб-приложении Flask Python (я использую Python 3.6.8), но когда я запускаю команду "cf push" или "ibmcloud app push", программа не может запустить приложение (Ожидание приложение, чтобы начать ...
Начало неудачно)
app.py:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Main module """
import os
import cf_deployment_tracker
from datetime import datetime
from flask import Flask, render_template, request, Response, make_response, abort
from flask_httpauth import HTTPBasicAuth
from dotenv import load_dotenv
# Emit Bluemix deployment event
cf_deployment_tracker.track()
app = Flask(__name__)
# define basic auth
auth = HTTPBasicAuth()
# 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))
if __name__ == '__main__':
load_dotenv(os.path.join(os.path.dirname(__file__), ".env"))
@app.route('/')
def home():
return "Hello world!"
###################### /API ENDPOINTS ##############################
if __name__ == '__main__':
app.run(host='0.0.0.0', port=port, debug=True, threaded=True)
setup.py:
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
setup(
name='hello-world',
version='1.0.0',
url='',
license='Apache-2.0'
)
manifest.yml:
---
applications:
- name: hello-world
memory: 256MB
stack: cflinuxfs3
buildpack: https://github.com/cloudfoundry/buildpack-python.git
requirements.txt:
cf-deployment-tracker==1.0.5
Flask==0.12.1
Flask-HTTPAuth==3.2.4
python-dotenv==0.9.1
runtime.txt:
python-3.6.8
PROCFILE:
web: python app.py
Есть CF события:
2019-05-31T09:28:06.00-0600 app.crash liza-speakfreely index: 0, reason: CRASHED, cell_id: d3330ee1-fbaf-4a02-b5bd-cadb9f384f63, instance: fec4b3fc-5d18-4236-74e2-9a38, exit_description: APP/PROC/WEB: Exited with status 127
2019-05-31T09:28:06.00-0600 audit.app.process.crash web index: 0, reason: CRASHED, cell_id: d3330ee1-fbaf-4a02-b5bd-cadb9f384f63, instance: fec4b3fc-5d18-4236-74e2-9a38, exit_description: APP/PROC/WEB: Exited with status 127
А есть журналы:
2019-05-31T11:09:45.99-0600 [CELL/0] OUT Cell ed57f560-073e-48e1-a5b8-e42888f07850 creating container for instance 49f46b7b-57ae-4479-5297-e47e
2019-05-31T11:09:50.84-0600 [CELL/0] OUT Cell ed57f560-073e-48e1-a5b8-e42888f07850 successfully created container for instance 49f46b7b-57ae-4479-5297-e47e
2019-05-31T11:09:57.74-0600 [CELL/0] OUT Starting health monitoring of container
2019-05-31T11:10:07.10-0600 [APP/PROC/WEB/0] ERR * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
2019-05-31T11:10:07.23-0600 [APP/PROC/WEB/0] ERR * Restarting with stat
2019-05-31T11:10:07.30-0600 [APP/PROC/WEB/0] ERR /usr/bin/env: ‘python3\r’: No such file or directory
2019-05-31T11:10:08.18-0600 [APP/PROC/WEB/0] OUT Exit status 127
2019-05-31T11:10:08.22-0600 [CELL/SSHD/0] OUT Exit status 0
2019-05-31T11:10:14.38-0600 [CELL/0] OUT Cell ed57f560-073e-48e1-a5b8-e42888f07850 stopping instance 49f46b7b-57ae-4479-5297-e47e
2019-05-31T11:10:14.38-0600 [CELL/0] OUT Cell ed57f560-073e-48e1-a5b8-e42888f07850 destroying container for instance 49f46b7b-57ae-4479-5297-e47e
2019-05-31T11:10:14.44-0600 [API/15] OUT Process has crashed with type: "web"
2019-05-31T11:10:14.46-0600 [API/15] OUT App instance exited with guid f48a4d09-f515-4c8c-8f6e-f416c50f496d payload: {"instance"=>"49f46b7b-57ae-4479-5297-e47e", "index"=>0, "cell_id"=>"ed57f560-073e-48e1-a5b8-e42888f07850", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 127", "crash_count"=>13, "crash_timestamp"=>1559322614375644796, "version"=>"48ca89cd-deaf-42dc-be23-699ef02a2c70"}
2019-05-31T11:10:14.74-0600 [PROXY/0] OUT Exit status 137
2019-05-31T11:10:16.70-0600 [CELL/0] OUT Cell ed57f560-073e-48e1-a5b8-e42888f07850 successfully destroyed container for instance 49f46b7b-57ae-4479-5297-e47e
2019-05-31T11:26:27.87-0600 [CELL/0] OUT Cell 64b8fbdd-c811-404e-a739-d7b7de546dcb creating container for instance 9e03bf72-5d07-45a8-7c93-244f
2019-05-31T11:26:28.95-0600 [CELL/0] OUT Cell 64b8fbdd-c811-404e-a739-d7b7de546dcb successfully created container for instance 9e03bf72-5d07-45a8-7c93-244f
2019-05-31T11:26:33.78-0600 [CELL/0] OUT Starting health monitoring of container
2019-05-31T11:26:34.82-0600 [APP/PROC/WEB/0] ERR * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
2019-05-31T11:26:34.82-0600 [APP/PROC/WEB/0] ERR * Restarting with stat
2019-05-31T11:26:34.82-0600 [APP/PROC/WEB/0] ERR /usr/bin/env: ‘python3\r’: No such file or directory
2019-05-31T11:26:34.89-0600 [APP/PROC/WEB/0] OUT Exit status 127
2019-05-31T11:26:34.89-0600 [CELL/SSHD/0] OUT Exit status 0
2019-05-31T11:26:41.42-0600 [CELL/0] OUT Cell 64b8fbdd-c811-404e-a739-d7b7de546dcb stopping instance 9e03bf72-5d07-45a8-7c93-244f
2019-05-31T11:26:41.42-0600 [CELL/0] OUT Cell 64b8fbdd-c811-404e-a739-d7b7de546dcb destroying container for instance 9e03bf72-5d07-45a8-7c93-244f
2019-05-31T11:26:41.48-0600 [API/26] OUT Process has crashed with type: "web"
2019-05-31T11:26:41.50-0600 [API/26] OUT App instance exited with guid f48a4d09-f515-4c8c-8f6e-f416c50f496d payload: {"instance"=>"9e03bf72-5d07-45a8-7c93-244f", "index"=>0, "cell_id"=>"64b8fbdd-c811-404e-a739-d7b7de546dcb", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 127", "crash_count"=>14, "crash_timestamp"=>1559323601416178033, "version"=>"48ca89cd-deaf-42dc-be23-699ef02a2c70"}
2019-05-31T11:26:41.62-0600 [PROXY/0] OUT Exit status 137
2019-05-31T11:26:42.75-0600 [CELL/0] OUT Cell 64b8fbdd-c811-404e-a739-d7b7de546dcb successfully destroyed container for instance 9e03bf72-5d07-45a8-7c93-244f