我想运行一个 python Flask hello world。我部署到 App Engine,但它显示端口正在使用中,并且看起来它正在多个实例/线程/克隆上同时运行。
这是我的 main.py
from flask import Flask
app = Flask(__name__)
@app.route('/hello')
def helloIndex():
print("Hello world log console")
return 'Hello World from Python Flask!'
app.run(host='0.0.0.0', port=4444)
Run Code Online (Sandbox Code Playgroud)
这是我的 app.yaml
runtime: python38
env: standard
instance_class: B2
handlers:
- url: /
script: auto
- url: .*
script: auto
manual_scaling:
instances: 1
Run Code Online (Sandbox Code Playgroud)
这是我的要求.txt
gunicorn==20.1.0
flask==2.2.2
Run Code Online (Sandbox Code Playgroud)
这是我得到的日志:
* Serving Flask app 'main'
* Debug mode: off
Address already in use
Port 4444 is in use by another program. Either identify …Run Code Online (Sandbox Code Playgroud) 我知道有人问过这个完全相同的问题: InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe' / angularfire2 [duplicate] 但是按照建议并不能解决我的问题。
我正在尝试从 Firebase 数据库中获取一个列表并以离子形式显示它。
我已经能够从数据库(通过console.log)获取数据,但是,我无法在应用程序中显示它。(也许问题更多出在 *ngFor 或 HTML 部分)
这是我项目中的 package.json:
{
"name": "brianAppResto",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"@angular/animations": "^5.1.3",
"@angular/common": "^5.1.3",
"@angular/compiler": "^5.1.3",
"@angular/compiler-cli": "^5.1.3",
"@angular/core": "^5.1.3",
"@angular/fire": "^5.0.2",
"@angular/forms": "^5.1.3",
"@angular/http": "^5.1.3",
"@angular/platform-browser": "^5.1.3",
"@angular/platform-browser-dynamic": "^5.1.3", …Run Code Online (Sandbox Code Playgroud) 我试图在每个人的内部逐个履行承诺.
对不起,我知道这可能是一个简单的问题,但我发现很难找到如何解决这个问题的答案.
我希望console.log会像这样显示
test
a
test
b
test
c
Run Code Online (Sandbox Code Playgroud)
但是,它显示这样
test
test
test
a
b
c
Run Code Online (Sandbox Code Playgroud)
这是我的代码 https://jsfiddle.net/brianivander/b6csvrn9/1/
var array1 = ['a', 'b', 'c'];
array1.forEach(function(element) {
promise().then(() => {
console.log(element);
})
});
function promise() {
return new Promise((resolve, reject) => {
console.log('test');
resolve()
})
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.