What is pymysql3 equivalent of django.db.backends.mysql

I run python33 and I installed pymysql3, but which ENGINE do I need to specify in 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. } } 
+4
source share
2 answers

See django-mysql-pymysql for more information. In particular,

 'ENGINE': 'mysql_pymysql', 

It was not enough for me. I had to use this answer . If you have a foo Django application, then add the following to your `foo / init .py ':

 import pymysql pymysql.install_as_MySQLdb() 
+3
source

Django already provides a MySQL backend. From a look at PyMySQL, he seems to be a universal MySQL client. You cannot arbitrarily use another library instead of existing Django backends; APIs will be completely incompatible.

There is a project that looks like providing a Django backend that uses PyMySQL internally , but the author claims to be experimental, it has only 5 commits, and it has not been updated since 2012, so I would not recommend using it.

+1
source

Source: https://habr.com/ru/post/1469053/


All Articles