Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/django/contrib/sessions/backends/base.py", line 168, in _get_session
return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py", line 134, in _cursor
return self.create_cursor()
File "/usr/local/lib/python3.4/dist-packages/mysql/connector/django/base.py", line 537, in create_cursor
cursor = self.connection.cursor()
File "/usr/local/lib/python3.4/dist-packages/mysql/connector/connection.py", line 1328, in cursor
raise errors.OperationalError("MySQL Connection not available.")
mysql.connector.errors.OperationalError: MySQL Connection not available.
I'm using Python 3.4 with Django 1.6 with mysql-connector-python 1.2.2.
I consistently get the above errors whenever I refresh the page after being idle for a while. I have tried setting CONN_MAX_AGE to 299/None/not setting it at all which defaults to 0, and it still occurs. When I return to the home page there are no errors but then if I go back to the original page I get this other error:
File "/usr/local/lib/python3.4/dist-packages/django/db/models/sql/where.py" in process
365. connection=connection, prepared=True)
File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/__init__.py" in get_db_prep_lookup
407. prepared=prepared)]
File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/__init__.py" in get_db_prep_value
912. return connection.ops.value_to_db_datetime(value)
File "/usr/local/lib/python3.4/dist-packages/mysql/connector/django/base.py" in value_to_db_datetime
392. return self.connection.connection.converter._datetime_to_mysql(value)
Exception Type: AttributeError at /user/log_in
Exception Value: 'NoneType' object has no attribute 'converter'
My website has the home page which doesn't do anything with the Django request object, and every other page requires a login. My steps to reproduce this is
- Log in to website
- Go to any page that requires me to be logged in
- Do nothing on the website for around half an hour (could be shorter but I always leave to do something else)
- Refresh the page and get the above 2 errors
- Go to the home page which loads fine
- Go to any page that requires me to be logged in and get the third error