简体   繁体   English

Heroku 应用程序错误:OSError:[Errno 98] 地址已在使用中

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

This is my project directory:这是我的项目目录:

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

Procfile : Procfile

web: gunicorn app:app

app.py : app.py

from flask import Flask

app = Flask(__name__)

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

app.run()

requirements.txt : 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

This is what I ran in the terminal:这是我在终端中运行的:

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

When I open the website, I get an Application error and when I check the logs I see:当我打开网站时,我收到一个Application error ,当我检查日志时,我看到:

OSError: [Errno 98] Address already in use

I checked and don't seem to have anything else running, what could be causing this error?我检查并似乎没有其他任何东西在运行,可能导致此错误的原因是什么?

Encapsulate the run:封装运行:

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

it should work.它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OSError: [Errno 98] 地址已在 heroku 中使用 - OSError: [Errno 98] Address already in use in heroku OSError: [Errno 98] 地址已被使用 - Heroku - OSError: [Errno 98] Address already in use - Heroku 面临错误:OSError:[Errno 98] 地址已在使用中:('',8089) - Facing error : OSError: [Errno 98] Address already in use: ('', 8089) OSError: [Errno 98] 地址已在使用中 - OSError: [Errno 98] Address already in use Python OSError: [Errno 98] 地址已在使用但未使用端口 - Python OSError: [Errno 98] Address already in use but no port is used Python 套接字 OSError: [Errno 98] 地址已在使用中 - Python socket OSError: [Errno 98] Address already in use OSError: [Errno 98] Address already in use Running Flask Application on Apache2 - OSError: [Errno 98] Address already in use Running Flask Application on Apache2 在 colab 上运行 netron 时,出现“OSError: [Errno 98] Address already in use”错误 - while running netron on colab, getting this “OSError: [Errno 98] Address already in use” error 错误:[Errno 98]地址已在使用中 - error: [Errno 98] Address already in use Flask Google Cloud App Engine:OSError:[Errno 98] 地址已在使用中 - Flask Google Cloud App Engine: OSError: [Errno 98] Address already in use
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM