簡體   English   中英

Heroku 應用程序錯誤:OSError:[Errno 98] 地址已在使用中

[英]Heroku Application Error: OSError: [Errno 98] Address already in use

這是我的項目目錄:

├── Procfile
├── app.py
└── requirements.txt

Procfile

web: gunicorn app:app

app.py

from flask import Flask

app = Flask(__name__)

@app.route("/")
def index():
    return "Hello, World!"

app.run()

requirements.txt

certifi==2020.6.20
chardet==3.0.4
click==7.1.2
Flask==1.1.2
gunicorn==20.0.4
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
requests==2.24.0
urllib3==1.25.10
Werkzeug==1.0.1

這是我在終端中運行的:

$ git init
$ heroku create
$ git add .
$ git commit -m "test"
$ git push heroku master
$ heroku open

當我打開網站時,我收到一個Application error ,當我檢查日志時,我看到:

OSError: [Errno 98] Address already in use

我檢查並似乎沒有其他任何東西在運行,可能導致此錯誤的原因是什么?

封裝運行:

if __name__ == '__main__':
    app.run()

它應該工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM