python - 属性错误 : module 'alembic.context' has no attribute 'config'

标签 python python-3.x python-import alembic

我从 alembic 中导入了上下文。但是 config 和 configure 等变量在包中不可用。可能是什么原因 ?

enter image description here

最佳答案

alembic.context仅适用于 env.py通过 alembic 执行的脚本命令,并假设 alembic命令从包含 alembic.ini 的文件夹中执行。文件指定要使用的 Alembic 配置。

否则,alembic模块没有 context属性(property)。

如需更多信息,请参阅 this answer to a similar question .

关于python - 属性错误 : module 'alembic.context' has no attribute 'config' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51203641/

相关文章:

python - 如何在 Ubuntu 12.04 中为 Python3 安装库 netifaces?

python - 如何使用Python分割字符串

python - Pyspark 导入 .py 文件不起作用

python - 从同一文件导入引发 ImportError

python - pip:从特定目录卸载包

python - 替换字符串中的多个元素

python - 无法将 HTML 从网站正确转换为文本

python - 警告 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

python -m 当前目录

python - 奇怪的 Python __import__ 行为