[英]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.