Django Ubuntu: Database returned an invalid value in QuerySet. dates (). Solution to the error

Source: Internet
Author: User
Tags time zones

Django Ubuntu: Database returned an invalid value in QuerySet. dates (). Solution to the error

This error occurs when running the Django project created in Windows! Database returned an invalid value in QuerySet. dates (). Are time zone definitions and pytz installed?

Install pytz as prompted

1. Install easy_install first:

sudo apt-get install python-setuptools

2. Go to the official website to get the file and use the wget command to download the file:

wget https://pypi.python.org/packages/2.7/p/pytz/pytz-2014.4-py2.7.egg#md5=1e394a3b24ef6a5848c46bed82810915

3. installation:

sudo easy_install pytz-2014.4-py2.7.egg

After the installation is complete, No. Search for the official documentation: Click the open link and read the prompt carefully. It seems to be the cause of the database. view the documentation: Click the open link.

Run the following command to restart:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Note:Mysql_tzinfo_to_ SQLProgram loads the time zone tables inmysqlDatabase. It is used on systems that haveZoneinfoDatabase (the set of files describing time zones). Examples of such systems are Linux, FreeBSD, Solaris, and Mac OS X. One likely location for these files is/usr/share/zoneinfoDirectory (/usr/share/lib/zoneinfoOn Solaris). If your system does not have a zoneinfo database, you can use the downloadable package described inSection 10.6, "MySQL Server Time Zone Support ".

This article by @ The_Third_Wave (Blog address: http://blog.csdn.net/zhanh1218) original. Otherwise, it will be updated from time to time. please correct me if any error occurs.

If you find that this Blog post is incomplete, it is the reason for me to prevent crawlers from releasing half of the posts first. Please refer to the original author's Blog.

If this blog post is helpful to you, you are not recommended to repost it for a good network environment. We recommend that you add it to your favorites! If you must reprint the content, please include the suffix and the address of this article.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.