Reputation: 61
I am running python33 and I have installed pymysql3 but what ENGINE do I need to specify in the Django settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'chris_test', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'some_user',
'PASSWORD': 'some password',
'HOST': 'some_host', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '3306', # Set to empty string for default.
}
}
Upvotes: 4
Views: 1827
Reputation: 70552
Django already provides a MySQL backend. From looking at PyMySQL, it appears to be a general-purpose MySQL client. You can't arbitrarily use a different library in place of the existing Django backends; the APIs would be completely incompatible.
There is a project that appears to provide a Django backend that uses PyMySQL internally, but the author states that it is experimental, it has a total of 5 commits, and it hasn't been updated since 2012, so I wouldn't recommend trying to use it.
Upvotes: 1
Reputation: 1218
Look at django-mysql-pymysql for more info. Specifically,
'ENGINE': 'mysql_pymysql',
That was not enough for me though. I had to use this answer . If you have a foo
Django app, then in your `foo/init.py', add the following:
import pymysql
pymysql.install_as_MySQLdb()
Upvotes: 3