相关疑难解决方法(0)

为什么我在 alembic 迁移方面遇到问题

项目结构(仅包含数据库迁移的目录):

--db_manage:
  alembic.ini
  --alembic:
    env.py
    script.py.mako
    README
    --versions:
      #migration files
Run Code Online (Sandbox Code Playgroud)

当我尝试运行 command: 时python db_manage/alembic/env.py,我有如下响应:

Traceback (most recent call last):
  File "db_manage/alembic/env.py", line 8, in <module>
    config = context.config
AttributeError: module 'alembic.context' has no attribute 'config'
Run Code Online (Sandbox Code Playgroud)

在哪种情况下我有这个问题?
PS
文件alembic.ini

# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = alembic

# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s

# max length of characters to apply to the
# "slug" field …
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy flask alembic

5
推荐指数
1
解决办法
9490
查看次数

标签 统计

alembic ×1

flask ×1

python ×1

sqlalchemy ×1