项目结构(仅包含数据库迁移的目录):
--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)