10.10.2014

Using MYSQL for python3.x with django.

Assume pip3 installed.

Install the official "mysql connector" from Oracle:
$ pip3 install --allow-external mysql-connector-python \ mysql-connector-python
 or
$ pip3.3 install --user https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.0.1.tar.gz

Edit database option in settings.py


DATABASES = {
    'default': {
        'NAME': 'user_data',
        'ENGINE': 'mysql.connector.django',
        'USER': 'mysql_user',
        'PASSWORD': 'priv4te',
        'OPTIONS': {
          'autocommit': True,
        },
    }
}


Official Document
http://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html



No comments: