django 1.10.2 mysql 5.6.34 which connector?

185 views
Skip to first unread message

Andres Marin

unread,
Oct 13, 2016, 6:47:02 PM10/13/16
to Django users
Dear all,

I'm trying to learn about django, follow the documentation, in my first:

python manage.py migrate


all time get this error:


File "/usr/local/lib/python3.5/site-packages/mysql/connector/django/operations.py", line 223, in bulk_insert_sql

    return "VALUES " + ", ".join([items_sql] * num_values)

TypeError: can't multiply sequence by non-int of type 'tuple'


I'm ussing mysql-connector-python-2.1.4 to connect to mysql:


settings.py:

...

'default': {

      'NAME': 'firstapp',

      'ENGINE': 'mysql.connector.django',

...

Python 3.5.2

django 1.10.2

mysql  5.6.34


Do you know which connector I can to use?


I was tried 'pip install mysql-python' to install MySQL-python-1.2.5 but is not possible, regarding with some google results, this version is not supported by python 3.


Any help, will be appreciated.


PD: learning django, I'm new user.


Thanks!

Tim Graham

unread,
Oct 13, 2016, 8:10:49 PM10/13/16
to Django users
Try mysqlclient as mentioned in https://docs.djangoproject.com/en/stable/ref/databases/#mysql-db-api-drivers.

As it says there, MySQL Connector/Python is developed by Oracle and may not support the most recent Django releases.

Ricardo Prado

unread,
Oct 13, 2016, 9:37:52 PM10/13/16
to Django users
First you can install python tools and other librarys

If you using Ubuntu or Debian, check this steps

sudo apt-get install python-setuptools apache2 libapache2-mod-wsgi

sudo apt-get install python-pip

sudo apt-get install python-dev libmysqlclient-dev


Don't use
 'ENGINE': 'mysql.connector.django',

USE
 'ENGINE': 'django.db.backends.mysql',

I hope help you

Andres Marin

unread,
Oct 13, 2016, 10:14:58 PM10/13/16
to Django users
Hi,

Thanks...

The steps to solve my issue:

install mysqlclient: pip install mysqlclient
thanks Tim Graham 

Configure in settings: 'ENGINE': 'django.db.backends.mysql',
Thanks Ricardo Prado

Now, all is working fine!

Regards!

AYMG
Reply all
Reply to author
Forward
0 new messages