Python中文
首页
教程
问答
标签
搜索
登录
注册
如何让alembic从Flas中的多个模型文件中识别模型
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>所以在Flask中我有<code>models.py</code>,它包含了我所有的模型定义。我想把它分成<code>models</code>目录下的多个模型文件。在</p> <p>我尝试添加一些模型文件,比如<code>models/user_model.py</code>,<code>models/booking_model.py</code>等,但是alembic似乎没有检测到这些文件中的模型。在</p> <p>在标准中亚历姆比奇.ini我有一个烧瓶:</p> <p/><div^{cl1}$ <div^{cl2}$ <pre class="snippet-code-html lang-html prettyprint-override"><code># A generic, single database configuration. [alembic] # template used to generate migration files # file_template = %%(rev)s_%%(slug)s # set to 'true' to run the environment during # the 'revision' command, regardless of autogenerate # revision_environment = false # Logging configuration [loggers] keys = root,sqlalchemy,alembic [handlers] keys = console [formatters] keys = generic [logger_root] level = WARN handlers = console qualname = [logger_sqlalchemy] level = WARN handlers = qualname = sqlalchemy.engine [logger_alembic] level = INFO handlers = qualname = alembic [handler_console] class = StreamHandler args = (sys.stderr,) level = NOTSET formatter = generic [formatter_generic] format = %(levelname)-5.5s [%(name)s] %(message)s datefmt = %H:%M:%S</code></pre> </div> </div> <p>我需要在这里添加一些东西来让alembic识别这些模型吗?在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>你需要编辑环境保护公司名称:</p> <pre><code># add your model's MetaData object here # for 'autogenerate' support from your_cool_app.models import * target_metadata = db.Model.metadata </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何将python输出重定向到python控制台和Windows中的文本文件
2 回答
如何将Python运行时嵌入运行在Windows上的R包中
10 回答
如何将python进程作为另一个Windows us运行
6 回答
如何将Python进程的输出用Python管道传输?
2 回答
如何将Python进程的输出重定向到Rust进程?
10 回答
如何将python连接到Azure云并创建Azure数据工厂
5 回答
如何将Python连接到Db2
3 回答
如何将python连接到IBMDB2?
5 回答
如何将Python连接到microsoftaccess数据库文件?
1 回答
如何将python连接到MySQL服务器
9 回答
如何将Python连接到Node.js?
1 回答
如何将python连接到Oracle Application Express
5 回答
如何将Python连接到PostgreSQL
6 回答
如何将Python连接到Postgres服务器?
3 回答
如何将Python连接到SAS Enterprise Guide(EG)服务器
9 回答
如何将Python连接到Spark会话并保持RDDs的Ali
6 回答
如何将python连接到sqlite3并在上填充多行
8 回答
如何将python连接到使用docker运行的cassandra
10 回答
如何将python退格应用于字符串
5 回答
如何将python逻辑应用到tkinter GUI中?这是一个简单的GET请求程序
4 回答