flask_migrate鏁版嵁搴撹縼绉婚亣鍒扮殑闂
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flask_migrate鏁版嵁搴撹縼绉婚亣鍒扮殑闂相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/UNC' title='UNC'>UNC
odi str eve cli dev name man cti鏈汉浣跨敤鐨刾ython鍜宲ip鐗堟湰閮芥槸3.6锛屼互涓嬩緥瀛愬熀浜庢鐗堟湰銆?/p>
鏈汉缂栧啓鐨刴anager.py鏂囦欢
# coding:utf-8 from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from ihome import create_app, db app = create_app(鈥?/span>development鈥?/span>) manager = Manager(app) # 闆嗘垚鏁版嵁搴撶殑杩佺Щ Migrate(app, db) manager.add_command(鈥?/span>db鈥?/span>, MigrateCommand) if __name__ == 鈥?/span>__main__鈥?/span>: manager.run()
鏁版嵁搴撹縼绉绘楠ゅ涓嬶細
1. python3.6 manager.py db init
2. python3.6 manager.py db migrate
姝ラ2閬囧埌濡備笅闂锛?/p>
ModuleNotFoundError: No module named 鈥楳ySQLdb鈥?/p>
瑙e喅鏂规硶锛?/p>
pip3 install mysqlclient
瀹夎mysqlclient杩囩▼涓亣鍒板涓嬮棶棰橈細
闂1锛?/p>
OSError: mysql_config not found
瑙e喅鏂规硶锛?/p>
yum install mysql-devel
闂2锛?/p>
fatal error: Python.h: No such file or directory
瑙e喅鏂规硶锛?/span>
yum install python36-devel
3. python3.6 manager.py db upgrade
鑷虫锛屾暟鎹簱杩佺Щ瀹屾垚銆?/p>
以上是关于flask_migrate鏁版嵁搴撹縼绉婚亣鍒扮殑闂的主要内容,如果未能解决你的问题,请参考以下文章
闈㈣瘯瀹橈細鏁版嵁搴撹繛鎺ユ睜涓轰粈涔堥兘瑕佺敤Threadlocal鍛紵
鍩轰簬SpringBoot鎼缓涓€涓甫鏁版嵁搴撹闂殑WEB椤圭洰(璁板綍鎵€闇€鐨勪緷璧?閰嶇疆,椹卞姩瀹夎绛夋敞鎰忎簨椤?