Many thanks for your response!! Here's a snapshot of flask_app.py (I kept only POOL_RECYCLE, as you suggest, and also TRACK_MODIFICATIONS, based on a pythonanywhere+flask tutorial):
app = Flask(__name__)
app.app_context().push() # this is to prevent context errors
app.config['SQLALCHEMY_DATABASE_URI'] ='mysql://libov:NNNN@libov.mysql.pythonanywhere-services.com/libov$expenses'
app.config["SQLALCHEMY_POOL_RECYCLE"] = 280
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
from datamodel import *
db.init_app(app)
app.config['SECRET_KEY'] = 'hard to guess string'
bootstrap = Bootstrap(app)
The rest is just the routes. The imported datamodel.py is like
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Balance(db.Model):
__tablename__ = 'BALANCE'
id = db.Column(db.Integer, primary_key = True)
amount = db.Column(db.Numeric(10,2), nullable=False)
date = db.Column(db.Date, nullable=False, unique=True)
(plus further table definitions)
So in summary, I first create an app, then create an SQLAlchemy object, and then "link" the two using init_app.
Thanks in advance for any help!!
Cheers
Slava