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 inmysql
Database. 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/zoneinfo
Directory (/usr/share/lib/zoneinfo
On 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.