With the Python3.4 and Django1.6, the database is still a common Internet enterprise MySQL.
Sad reminder is in Python2.7 ERA connection MySQL MYSQLDB also not support Python3.4, fortunately, hard to ask G brother finally found a substitute, and the effect is good, this substitute is: Pymysql.
Download this and install it, no different than the other Python third package, the same installation.
The same thing about databases in Django1.6 is that you don't have to make any changes, as you did in the previous mysqldb, as follows:
1 DATABASES = {2 ' default ': {3 ' ENGINE ': ' Django.db.backends.mysql ', #数据库引擎 4 ' NAME ': ' Test ', #数据库名 5
' USER ': ' Root ', #用户名 6 ' PASSWORD ': ' Root ', #密码 7 ' HOST ': ', #数据库主机, default to localhost 8 ' PORT ': ', #数据库端口, MySQL defaults to 3306 9 ' OPTIONS ': {ten ' autocommit ': true,11 },12 }13}
The most critical point, in the site's __init__.py file, we add the following code:
1 Import pymysql2 pymysql.install_as_mysqldb ()
Once you've done this, you'll be able to access MySQL in Django.