Flask-migrate makes SQLite migration instead of PSQL

421 views Asked by At

Hi I've exported in virtualenv database with command

export DATABASE_URL="postgresql://localhost/dbname"

But after running

python manage.py init

and

python manage.py db migrate

Result is:

INFO  [alembic.runtime.migration] Context impl SQLiteImpl.

PostreSQL database have been previously created and SQLAlchemy URI have been set in config.py file. During migration i have opened psql db in another terminal window (in the venv) with commands

psql

and then

\c dbname

How can I connect to the PSQL db?

1

There are 1 answers

0
Paul Savala On

You do not have the correct connection string. The format is

dialect+driver://username:password@host:port/database

So yours should be

postgresql://username:password@localhost:5432/dbname

Source: https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls