[英]Flask-migrate makes SQLite migration instead of PSQL
Hi I've exported in virtualenv database with command 嗨,我已经使用命令在virtualenv数据库中导出了
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. 以前已经创建了PostreSQL数据库,并且已经在config.py文件中设置了SQLAlchemy URI。 During migration i have opened psql db in another terminal window (in the venv) with commands
在迁移期间,我已使用命令在另一个终端窗口(在venv中)中打开了psql db
psql
and then 接着
\c dbname
How can I connect to the PSQL db? 如何连接到PSQL数据库?
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 来源: https : //docs.sqlalchemy.org/en/13/core/engines.html#database-urls
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.