Home > OS >  My heroku application is not working with flask application
My heroku application is not working with flask application

Time:09-17

my heroku app is not working I also don't see any error in my code it is very simple index.html in templates:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> Srikar's Messaging App!</title>

</head>
</html>

app.py file:

from flask import Flask, render_template, url_for, redirect, request, session
from flask_socketio import SocketIO, send
app = Flask(name)


@app.route("/")
def login():
    return render_template('index.html')
@app.route("/home")
def home():
    return "welcome to homepage!"

if name == "main":
    app.run(debug=False,host="0.0.0.0")

Requirements file:

Flask==2.0.1
Flask-Login==0.5.0
flask-ngrok==0.0.25
Flask-SQLAlchemy==2.5.1
future==0.18.2
gevent==21.1.2
gevent-websocket==0.10.1
greenlet==1.1.0
gunicorn==20.1.0
python-socketio==5.4.0

My Procfile:

web: gunicorn app:app

CodePudding user response:

When using Flask on Heroku typically you need to bind to the PORT provided by Heroku

p = int(os.environ.get("PORT", 5000))
app.run(debug=False, port=p, host='0.0.0.0')

PS it is better to also post the Heroku logs so there is some extra info about the problem you encounter

  • Related