Bug #71438 | Django Database Backend Has Errors with Time Functions | ||
---|---|---|---|
Submitted: | 21 Jan 2014 3:37 | Modified: | 12 Feb 2014 21:47 |
Reporter: | Joe Ciskey | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / Python | Severity: | S2 (Serious) |
Version: | 1.1 | OS: | Any |
Assigned to: | Peeyush Gupta | CPU Architecture: | Any |
Tags: | Django |
[21 Jan 2014 3:37]
Joe Ciskey
[30 Jan 2014 12:42]
John Kirkwood
With a fresh install of Django 1.6.1/MySQL 5.5.35/Python 3.2.3/ MySQL Connector/Python 1.1.4, I get: AttributeError at /admin/ 'NoneType' object has no attribute 'converter' when I try to access the default admin pages for the first time. The stack trace shows that the code already has the extra .connection mentioned above? /usr/local/lib/python3.2/dist-packages/mysql/connector/django/base.py in value_to_db_datetime 343. return self.connection.connection.converter._datetime_to_mysql(value)
[7 Feb 2014 10:10]
Peeyush Gupta
We are working on this bug, for a quick workaround, try setting AUTOCOMMIT to False in the DATABASES dictionary of django's configuration file i.e. settings.py.
[10 Feb 2014 9:38]
phiree yuen
i get the same error. i add 'AUTOCOMMIT':False in the db dictionary of settings.py. it works but can't save data into mysql in the admin panel.
[12 Feb 2014 21:47]
Paul DuBois
Noted in 1.1.6 changelog. Connector/Python produced errors using time functions with Django 1.6 due to not using the autocommit value from Django. Now the value is set to that specified in the Django configuration file.
[22 May 2014 6:34]
Radek Juppa
I am using Django 1.6.2/MySQL 5.5.35/Python 3.3/ MySQL Connector/Python 1.1.6 In setting of database I use AUTOCOMMIT 'default': { 'ENGINE': 'mysql.connector.django', 'NAME': 'database', 'USER': 'username', 'PASSWORD': 'password', 'HOST': '127.0.0.1', 'PORT': '3306', 'OPTIONS': { 'autocommit': False, } }, I am getting the exception 'NoneType' object has no attribute 'converter' when I access my site for the first time after long time of inactivity. Typically next day morning. I need to restart appache to get it working again. I dont understand what is the resolution. Is this bug in MySql connector or Django? What is workaround?
[22 May 2014 9:13]
Joris Minjat
@Radek Juppa I have the same problem, it's due to a timeout on mysql connection. Apparently we have to play with the 'CONN_MAX_AGE' database parameter in django settings. I tried a little bit but still can't resolve the problem. I have nearly the same configuration, just using mysql 5.6 Hope someone can help, has it's happening on my production servers I had to use an awful solution (doing a dumb select every x hours)