Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

需要安装MySQLdb或者pymysql #6

Open
pjxxcc opened this issue Oct 16, 2017 · 1 comment
Open

需要安装MySQLdb或者pymysql #6

pjxxcc opened this issue Oct 16, 2017 · 1 comment

Comments

@pjxxcc
Copy link

pjxxcc commented Oct 16, 2017

我平时使用pymysql链接mysql数据库,电脑上只安装了pymysql,运行项目时报错“No module named 'MySQLdb'”。
看了requirements.txt内又没有列出这个模块,有点摸不着头脑。
折腾了很久才在知乎找到答案。https://www.zhihu.com/question/29719547

app.config['SQLALCHEMY_DATABASE_URI'] 如下定义时会程序会引用MySQLdb模块:
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://laimingxing:[email protected]/test"

如下定义时才会引用pymysql模块:
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://laimingxing:[email protected]/test"

@zhll912
Copy link

zhll912 commented Nov 8, 2017

你的回答很有帮助 ,谢谢 @pjxxcc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants