'Crash app error while trying to deploy react-flask app on heroku

I'm currently getting this error when I run the heroku logs --tail command.

at=error code=H10 desc="App crashed" method=GET path="/" host=digital-engagement-tool.herokuapp.com request_id=72b795df-278b-41f8-885c-71cad4b302f0 fwd="123.201.36.104" dyno= connect= service= status=503 bytes= protocol=https

2021-05-18T07:51:47.875518+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=digital-engagement-tool.herokuapp.com request_id=ddd95750-0437-41b2-89e8-973c709039f0 fwd="123.201.36.104" dyno= connect= service= status=503 bytes= protocol=https

My Procfile:

web: gunicorn app:react-flask-app

I have named the app 'react-flask-app' because that's the name in my package.json file. Is that correct?

My api.py file:

app = Flask(__name__, static_folder='./build', static_url_path='/')
app = Flask(__name__, static_folder='./build', static_url_path='/')
app.config['SQLALCHEMY_DATABASE_URI'] = Config.SQLALCHEMY_DATABASE_URI
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['MAIL_SERVER']= Config.MAIL_SERVER
app.config['MAIL_PORT'] = Config.MAIL_PORT
app.config['MAIL_USERNAME'] = Config.MAIL_USERNAME
app.config['MAIL_PASSWORD'] = Config.MAIL_PASSWORD
app.config['MAIL_USE_SSL'] = Config.MAIL_USE_SSL
mail = Mail(app)
db = flask_sqlalchemy.SQLAlchemy(app)


@app.route('/')
def index():
  return app.send_static_file('index.html')

----Other routes relevant to my application. Example:

 @app.route('/hcp-npi-name', methods=['GET', 'POST'])
 def hcp_npi_name():
   engine = connect_pg()
   param = request.get_json()
   sql = "select a.* from dim_hcp_details a join dim_geography_table b on a.aligned_geography_id = 
      b.geography_id where b.user_id = " + str(param['user_id']) + " limit 1"
   print(sql)
   hcp_details = pd.read_sql_query(sql,engine)
   hcp_details['npi_hcp_concat'] = "[" + hcp_details['npi'] + "]" + hcp_details['first_name']
   hcp_dict = hcp_details.to_dict()
   return jsonify(hcp_dict)

And then:

@app.errorhandler(404)
def not_found(e):
   return app.send_static_file('index.html')

if __name__ == "__main__":
  app.run(host='0.0.0.0', debug=False, port=os.environ.get('PORT', 80))

After this, I also ran these commands in the terminal to create the heroku application.

 heroku create digital-engagement-tool
 heroku git:remote -a digital-engagement-tool

After that, I pushed this using the git push heroku master command.

I've used this link to deploy on heroku: How to Deploy a React + Python Flask Project on Heroku

Does anyone know where I'm going wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source