Python-MySQLdb源码安装
如自动化脚本所示:
如自动化脚本所示:
- cd $SRCDIR
- apt-get install -y python-dev libmysqld-dev
- wget http://nchc.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz
- tar -zxvf MySQL-python-1.2.3.tar.gz
- cd MySQL-python-1.2.3
- sed -i -e "s/#mysql_config = \/usr\/local\/bin\/mysql_config/mysql_config=\/usr\/local\/bin\/mysql\/bin\/mysql_config/g" ./site.cfg
- python setup.py build
- python setup.py install
- ln -s $INSTALLDIR/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
python manage.py syncdb
为数据库中每个应用建立一个数据库表。
然而如果你安装的Django Version >= 1.9,那么会出现如下问题:
gzxultra@gzxultraPC:~/django_try/mysite$ python manage.py syncdb
Unknown command: 'syncdb'
Type 'manage.py help' for usage.
gzxultra@gzxultraPC:~/django_try/mysite$ python manage.py syncdbpython manage.py syncdb
Unknown command: 'syncdbpython'
Type 'manage.py help' for usage.
在stackoverflow上找到原因和解决方法:
syncdb is deprecated because of the migration system
.
Now you can log your changes using makemigrations. This transforms your model changes into python code to make them deployable to another databases.
After you created the migrations you have to apply them: migrate.
So instead of using syncdb you should use makemigrations and then migrate.
简言之:在Django 1.9及未来的版本种使用migrate代替syscdb.