MySQL Forums
Forum List  »  Connector/Python

Django 1.10 + mysql connector 2.1.4
Posted by: matthew sadler
Date: September 10, 2016 09:06AM

I have been trying to get django 1.10 to work with mysql for a while now and i have managed to get it working with mysql connector i ran into a few issues that i have been able to figure myself.
A data timezone issue happened and i just changed this in setting.py
USE_TZ = False
I then ran into this issue:
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/path/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/path/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/path/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/path/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/path/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 224, in handle
    self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,
  File "/path/lib/python3.5/site-packages/django/core/management/sql.py", line 53, in emit_post_migrate_signal
    **kwargs
  File "/path/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 191, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/path/lib/python3.5/site-packages/django/contrib/auth/management/__init__.py", line 83, in create_permissions
    Permission.objects.using(using).bulk_create(perms)
  File "/path/lib/python3.5/site-packages/django/db/models/query.py", line 452, in bulk_create
    ids = self._batched_insert(objs_without_pk, fields, batch_size)
  File "/path/lib/python3.5/site-packages/django/db/models/query.py", line 1068, in _batched_insert
    self._insert(item, fields=fields, using=self.db)
  File "/path/lib/python3.5/site-packages/django/db/models/query.py", line 1045, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/path/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1053, in execute_sql
    for sql, params in self.as_sql():
  File "/path/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1038, in as_sql
    result.append(self.connection.ops.bulk_insert_sql(fields, placeholder_rows))
  File "/path/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 take it this has happened because mysql connector isn`t comp with django 1.10 atm.
Does anyone have a work around for this?

Options: ReplyQuote


Subject
Written By
Posted
Django 1.10 + mysql connector 2.1.4
September 10, 2016 09:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.