<p>我试图将Flask Blogging添加到现有的应用程序中,但它似乎不想在现有的Flask SQLAlchemy MySQL数据库上玩得很好。但是,它使用自己的sqlite数据库工作得很好。在</p>
<p>在应用程序启动时,它会尝试创建表(每次),但不会给出错误:</p>
<pre><code>flask run
* Serving Flask app "myapp"
* Forcing debug mode on
2017-06-13 21:32:33,369:DEBUG:flask-blogging:Created table with table name post
2017-06-13 21:32:33,371:DEBUG:flask-blogging:Created table with table name tag
2017-06-13 21:32:33,373:DEBUG:flask-blogging:Created table with table name tag_posts
2017-06-13 21:32:33,375:DEBUG:flask-blogging:Created table with table name user_posts
2017-06-13 21:32:33,472:INFO:werkzeug: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
</code></pre>
<p>然而,访问blog路由会抱怨(正确地)表不存在。在数据库里看他们不在那里。在</p>
<p>以下是相关代码:</p>
^{pr2}$
<p><code>config</code>是一个配置对象,它包含相关的sql连接字符串(在<code>SQLALCHEMY_DATABASE_URI</code>中)以及其他必需的Flask配置变量,对于应用程序的其余部分来说工作正常。在</p>