Check this thread:

        https://groups.google.com/forum/#!topic/django-users/cb_IGZXVuVQ

François

On Jul 21, 2014, at 4:23 PM, Henrique Oliveira <[email protected]> 
wrote:

> Hi there,
> 
> I am getting this error after hours:
> 
>  File "/opt/d/lib/python3.4/site-packages/django/contrib/sites/models.py", 
> line 45, in get_current
>     current_site = SITE_CACHE[sid]
> 
> KeyError: 1
> 
> 
> During handling of the above exception, another exception occurred:
> 
> 
> Traceback (most recent call last):
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/backends/__init__.py", 
> line 131, in _cursor
>     return self.create_cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/mysql/connector/django/base.py", 
> line 537, in create_cursor
>     cursor = self.connection.cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/mysql/connector/connection.py", 
> line 1328, in cursor
>     raise errors.OperationalError("MySQL Connection not available.")
> 
> mysql.connector.errors.OperationalError: MySQL Connection not available.
> 
> 
> The above exception was the direct cause of the following exception:
> 
> 
> Traceback (most recent call last):
> 
>   File "/opt/d/lib/python3.4/site-packages/django/core/handlers/base.py", 
> line 114, in get_response
>     response = wrapped_callback(request, *callback_args, **callback_kwargs)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/views/generic/base.py", 
> line 69, in view
>     return self.dispatch(request, *args, **kwargs)
> 
>   File "/opt/d/lib/python3.4/site-packages/allauth/account/views.py", line 
> 62, in dispatch
>     **kwargs)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/views/generic/base.py", 
> line 87, in dispatch
>     return handler(request, *args, **kwargs)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/views/generic/edit.py", 
> line 161, in get
>     return self.render_to_response(self.get_context_data(form=form))
> 
>   File "/opt/d/lib/python3.4/site-packages/allauth/account/views.py", line 
> 111, in get_context_data
>     "site": Site.objects.get_current(),
> 
>   File "/opt/d/lib/python3.4/site-packages/django/contrib/sites/models.py", 
> line 47, in get_current
>     current_site = self.get(pk=sid)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/manager.py", line 
> 151, in get
>     return self.get_queryset().get(*args, **kwargs)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/query.py", line 
> 301, in get
>     num = len(clone)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/query.py", line 
> 77, in __len__
>     self._fetch_all()
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/query.py", line 
> 854, in _fetch_all
>     self._result_cache = list(self.iterator())
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/query.py", line 
> 220, in iterator
>     for row in compiler.results_iter():
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/sql/compiler.py", 
> line 709, in results_iter
>     for rows in self.execute_sql(MULTI):
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/models/sql/compiler.py", 
> line 781, in execute_sql
>     cursor = self.connection.cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/backends/__init__.py", 
> line 159, in cursor
>     cursor = util.CursorWrapper(self._cursor(), self)
> 
>   File "/opt/d/lib/python3.4/site-packages/mysql/connector/django/base.py", 
> line 552, in _cursor
>     return super(DatabaseWrapper, self)._cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/backends/__init__.py", 
> line 131, in _cursor
>     return self.create_cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/utils.py", line 99, in 
> __exit__
>     six.reraise(dj_exc_type, dj_exc_value, traceback)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/utils/six.py", line 535, in 
> reraise
>     raise value.with_traceback(tb)
> 
>   File "/opt/d/lib/python3.4/site-packages/django/db/backends/__init__.py", 
> line 131, in _cursor
>     return self.create_cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/mysql/connector/django/base.py", 
> line 537, in create_cursor
>     cursor = self.connection.cursor()
> 
>   File "/opt/d/lib/python3.4/site-packages/mysql/connector/connection.py", 
> line 1328, in cursor
>     raise errors.OperationalError("MySQL Connection not available.")
> 
> django.db.utils.OperationalError
> 
> Any ideas to solve this?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/eea4aae8-2f50-4571-89b4-71a2cdb6a559%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E037E27B-58F8-4065-A7BE-6444256BE635%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to