Python Django Error-Django.db.utils.DatabaseError:列';应用';在第一排

Python Django Error-Django.db.utils.DatabaseError:列';应用';在第一排,python,django,python-3.5,Python,Django,Python 3.5,我在执行python manage.py migrate时遇到了一个奇怪的问题 下面是错误 django.db.utils.DatabaseError:第1行“应用”列的数据被截断 有人能帮我吗 谢谢 这是我的models.py数据 # This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models

我在执行
python manage.py migrate
时遇到了一个奇怪的问题

下面是错误

django.db.utils.DatabaseError:第1行“应用”列的数据被截断

有人能帮我吗

谢谢

这是我的models.py数据

# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey has `on_delete` set to the desired behavior.
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from __future__ import unicode_literals

from django.db import models


class Threads(models.Model):
    date = models.DateTimeField(db_column='Date', blank=True, null=True)  # Field name made lowercase.
    supplier = models.CharField(db_column='Supplier', max_length=45, blank=True, null=True)  # Field name made lowercase.
    activethreads = models.CharField(db_column='ActiveThreads', max_length=45, blank=True, null=True)  # Field name made lowercase.
    threadscreated = models.CharField(db_column='ThreadsCreated', max_length=45, blank=True, null=True)  # Field name made lowercase.
    ipaddress = models.CharField(db_column='IPAddress', max_length=45, blank=True, null=True)  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'Threads'


class DjangoContentType(models.Model):
    name = models.CharField(max_length=100)
    app_label = models.CharField(max_length=100)
    model = models.CharField(max_length=100)

    class Meta:
        managed = False
        db_table = 'django_content_type'
        unique_together = (('app_label', 'model'),)


class DjangoMigrations(models.Model):
    app = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    applied = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'django_migrations'

下面的URL中提到了我的问题的解决方案,这是Django最新版本的一个bug。您需要在settings.py中更改USE_TZ=False

执行上述更改后,在运行“python manage.py migrate”时将遇到不同的问题,这将导致以下错误

TypeError:无法将序列与“tuple”类型的非int相乘

有关此问题,请参考下面提到的Chris Barrett解决方案

您需要在/3.5.2/lib/python3.5/site-packages/mysql/connector/django/operations.py版本中进行必要的更改(检查您的设置)并进行更改

def bulk_insert_sql(self, fields, placeholder_rows):
        """
        Format the SQL for bulk insert
        """
        placeholder_rows_sql = (", ".join(row) for row in placeholder_rows)
        values_sql = ", ".join("(%s)" % sql for sql in placeholder_rows_sql)
        return "VALUES " + values_sql

向我们展示您的模型和迁移取消选择NN,看看会发生什么,否则发布更多上下文。@SardorbekImomaliev-我已在我的question@almostabeginner-我试过了,运气不好。请检查settings.py-->数据库。你在使用mysql吗?