django1.6.x(python3.3)使用pymysql连接mysql

时间:2022-01-08 08:58:04

1.安装 pymysql,地址:https://code.google.com/p/pymysql/

2.安装django 然后执行 django-admin.py startproject mysite

3.在project的__init__.py中加如下面的语句

  try:

    import pymysql
    pymysql.install_as_MySQLdb()
  except ImportError:
    pass

4.运行python manage.py runserver 即可.