zoukankan      html  css  js  c++  java
  • [ flask-migrate ] 记自己犯的一次低级错误

    问题描述

    从github上pull了别人的项目学习,项目用flask-migrate来迁移数据库。查看了一下,作者把数据库文件 app.db 删除了,不过migrations文件夹留着的,因此我只需要用命令 flask db migrate 和 flask db upgrade 来建立数据库文件就行了。执行过程中报错如下:

    c:usersadministratorappdatalocalprogramspythonpython37libsite-packagesflask_sqlalchemy\__init__.py:814: UserWarning: Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. Defaulting SQLALCHEMY_DATABASE_URI to "sqlite:///:memory:".
      'Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. '
    c:usersadministratorappdatalocalprogramspythonpython37libsite-packagesflask_sqlalchemy\__init__.py:835: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
      'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
    INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
    INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
    ERROR [root] Error: Target database is not up to date.

    排查了各个方面,配置文件没问题,model没问题,__init__文件也没问题。

    解决方案

    醉了,执行flask db之前先导入项目啊!!!!!!!!!!!!!!

    不然flask怎么知道你要执行哪个呢????????????????

  • 相关阅读:
    UVa 12174 (滑动窗口) Shuffle
    UVa 1607 (二分) Gates
    CodeForces ZeptoLab Code Rush 2015
    HDU 1525 (博弈) Euclid's Game
    HDU 2147 (博弈) kiki's game
    UVa 11093 Just Finish it up
    UVa 10954 (Huffman 优先队列) Add All
    CodeForces Round #298 Div.2
    UVa 12627 (递归 计数 找规律) Erratic Expansion
    UVa 714 (二分) Copying Books
  • 原文地址:https://www.cnblogs.com/remly/p/12213236.html
Copyright © 2011-2022 走看看