Well, you have two things to solve.
First, the requirements.txt
which isn't that much of a problem. You can either throw all the requirements in the same requirements.txt
file, having both database bindings installed doesn't harm anything. If you want to separate, however, just use requirements.txt
for deploying, and requirements-dev.txt
for local development.
More important is the DB settings itself, and for that you have a one liner solution:
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(
'DATABASE_URL', 'sqlite:////tmp/test.db')
Since DATABASE_URL
is set on Heroku, but not on local (make sure this is the case), os.environ.get
will not find it, thus reverting to the default, which is the sqlite connection string .