标签:wpa ntb otp not erp msu rpg hunk hmm
由于.sqlite文件操作的诸多不便,决定常识用MySQL代替书上的SQLite作为数据库。
1.在虚拟环境中安装mysql-Python具体步骤为:
<1> 安装python-dev
sudo apt-get install python-dev
<2>安装 libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
<3>安装mysql-python
pip install mysql-python
2.安装完成后发现MySQLdb模块在虚拟环境中可成功导入,则说明安装成功,下面是使用mysql代替sqlite的方法:
<1>更改SQLALCHEMY_DATABASE_URI
变量为:‘mysql://root:thinkive@127.0.0.1:3306/BlogTest‘
<2>在mysql中创建名为BlogTest
的库
create database BlogTest default character
set
utf8 collate utf8_general_ci;
此时,数据库表里是空的没有任何数据
<3>创建数据库表和字段
$service redis start
$service mysqld start
$celery worker -A celery_worker.celery -l INFO &
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade
$ python manage.py datainit
$ python manage.py runserver -h 0.0.0.0
http://blog.csdn.net/kkevinyang/article/details/52183768
http://www.moguf.com/post/py3flaskmysql
标签:wpa ntb otp not erp msu rpg hunk hmm
原文地址:http://www.cnblogs.com/qmfsun/p/6323697.html