• AttributeError: 'unicode' object has no attribute 'tzinfo' 未解决


    Internal Server Error: /demo/machineinfo.html
    Traceback (most recent call last):
    File "C:Python27libsite-packagesdjangocorehandlersexception.py", line 41, in inner
    response = get_response(request)
    File "C:Python27libsite-packagesdjangocorehandlersase.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
    File "C:Python27libsite-packagesdjangocorehandlersase.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "G:pythonprojectmyAppmachineviews.py", line 25, in htmlmachineinfo
    print machineinfo.objects.filter(serialNumber=machineser)
    File "C:Python27libsite-packagesdjangodbmodelsquery.py", line 226, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
    File "C:Python27libsite-packagesdjangodbmodelsquery.py", line 250, in __iter__
    self._fetch_all()
    File "C:Python27libsite-packagesdjangodbmodelsquery.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
    File "C:Python27libsite-packagesdjangodbmodelsquery.py", line 62, in __iter__
    for row in compiler.results_iter(results):
    File "C:Python27libsite-packagesdjangodbmodelssqlcompiler.py", line 842, in results_iter
    row = self.apply_converters(row, converters)
    File "C:Python27libsite-packagesdjangodbmodelssqlcompiler.py", line 827, in apply_converters
    value = converter(value, expression, self.connection, self.query.context)
    File "C:Python27libsite-packagesdjangodbackendsmysqloperations.py", line 239, in convert_datetimefield_value
    value = timezone.make_aware(value, self.connection.timezone)
    File "C:Python27libsite-packagesdjangoutils imezone.py", line 285, in make_aware
    return timezone.localize(value, is_dst=is_dst)
    File "C:Python27libsite-packagespytz\__init__.py", line 222, in localize
    if dt.tzinfo is not None:
    AttributeError: 'unicode' object has no attribute 'tzinfo'

    临时决解方案把数据库里面的

    models.DateTimeField(auto_now_add=True)
    相关时间语句先注释掉,然后在执行,目前还没找到解决办法,先绕过
    后续有决解办法在进行更新
  • 相关阅读:
    js string format All In One
    CSS water wave effect All In One
    Github PR 时合并多次提交的 git commits All In One
    js auto selector dom by providing id All In One
    JSS All In One
    python 中将fastq文件保存为字典
    python 中统计fasta文件中每条序列的长度
    c语言中利用do while循环语句限制用户的输入范围
    python中记录程序运行时间
    c语言中的do while循环语句
  • 原文地址:https://www.cnblogs.com/monsteryang/p/9567013.html
Copyright © 2020-2023  润新知