I'm trying to extend the flask-base project https://github.com/hack4impact/flask-base/tree/master/app .
I have used flask-migrate to create migrations for my local sqlite db.
I now need to migrate from the local sqlite db to heroku's postgres. Following https://www.quora.com/What-is-the-best-way-to-copy-my-SQLite-database-to-PostgreSQL-so-I-can-deploy-it-to-Heroku , I'm trying I set up a local postgres db called 'test' (screenshot)
I set:
os.environ["TEST_DATABASE_URL"] = "postgresql+psycopg2://127.0.0.1:5432/test" # REMOVE THIS !!!!!!!!!!
There is a test config in the config.py containing:
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')
print('TestingConfig - psgres?')
print(SQLALCHEMY_DATABASE_URI)
WTF_CSRF_ENABLED = False
However when I perform the upgrade with flask-migrate:
$ python manage.py db upgrade
TestingConfig - psgres?
postgresql+psycopg2://127.0.0.1:5432/test
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 78401e355127, empty message
A new sqlite db is created. Obviously I'm not connecting to the postgres test db. How can I get this working?
