django - MySQL server has gone away (code 2006) -



django - MySQL server has gone away (code 2006) -

i sow post on

how enable mysql client auto re-connect mysqldb?

i had same problem, utilize pythonanywhere.com , when write p.save() had error below.

it says updating mysql prepare it, don't know code or shell commands need write.

can help me?

traceback (most recent phone call last): file "<console>", line 1, in <module> file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/models/base.py", line 545, in save force_update=force_update, update_fields=update_fields) file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/models/base.py", line 570, in save_base transaction.commit_on_success_unless_managed(using=using, savepoint=false): file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/transaction.py", line 280, in __enter__ connection.set_autocommit(false) file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 340, in set_autocommit self._set_autocommit(autocommit) file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 461, in _set_autocommit self.connection.autocommit(autocommit) file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 461, in _set_autocommit self.connection.autocommit(autocommit) file "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/mysqldb/connections.py", line 243, in autocommit _mysql.connection.autocommit(self, on) operationalerror: (2006, 'mysql server has gone away')

your connection database closed because idle long. traceback, looks doing queries interactively. if know you've been idle more 5 min, should this:

from django.db import connection; connection.close()

mysql django

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -