Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#11691 closed Uncategorized (invalid)

"i18n/setlang" requires database access?

Reported by: Qian Xu Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Dear Developers,

I want to create a multi-language website without database.
I looked the doc and made a dropdown box for switching the language.
But when I switched the language, I saw the following error messages:

Traceback (most recent call last):

  File "/usr/local/lib/python2.5/site-packages/django/core/servers/", line 279, in run
    self.result = application(self.environ, self.start_response)

  File "/usr/local/lib/python2.5/site-packages/django/core/servers/", line 651, in __call__
    return self.application(environ, start_response)

  File "/usr/local/lib/python2.5/site-packages/django/core/handlers/", line 245, in __call__
    response = middleware_method(request, response)

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/", line 36, in process_response

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/", line 52, in save
    session_key = self.session_key,

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/", line 152, in _get_session_key
    self._session_key = self._get_new_session_key()

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/", line 144, in _get_new_session_key
    if not self.exists(session_key):

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/", line 25, in exists

  File "/usr/local/lib/python2.5/site-packages/django/db/models/", line 120, in get
    return self.get_query_set().get(*args, **kwargs)

  File "/usr/local/lib/python2.5/site-packages/django/db/models/", line 300, in get
    num = len(clone)

  File "/usr/local/lib/python2.5/site-packages/django/db/models/", line 81, in __len__
    self._result_cache = list(self.iterator())

  File "/usr/local/lib/python2.5/site-packages/django/db/models/", line 238, in iterator
    for row in self.query.results_iter():

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/", line 287, in results_iter
    for rows in self.execute_sql(MULTI):

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/", line 2360, in execute_sql
    sql, params = self.as_sql()

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/", line 396, in as_sql
    out_cols = self.get_columns(with_col_aliases)

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/", line 740, in get_columns

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/", line 823, in get_default_columns
    r = '%s.%s' % (qn(alias), qn2(field.column))

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/", line 175, in quote_name_unless_alias
    r = self.connection.ops.quote_name(name)

  File "/usr/local/lib/python2.5/site-packages/django/db/backends/dummy/", line 15, in complain
    raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."

ImproperlyConfigured: You haven't set the DATABASE_ENGINE setting yet.

I just wondered, does session have anything to do with database?

BTW: The documentation of django does not give a clear overview of a topic. Almost everything is described pointlessly. Could you take a look at the doc of CodeIgniter ( and make yours more easier to understand?

Best regards, Qian Xu

Change History (3)

comment:1 Changed 9 years ago by dc

Resolution: invalid
Status: newclosed

set_language view uses django sessions if available and default sessions storage is database.

This is not a Django bug. Please ask usage questions on django-users or #django channel.

comment:2 Changed 9 years ago by Qian Xu

Thanks. After having added SESSION_ENGINE = "django.contrib.sessions.backends.cache", it works.
I checked my, the session settings were not configured.
But I just wondered, why django uses database as the default storage for session.

comment:3 in reply to:  2 Changed 5 years ago by NeoOrion

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

Thanks for share the solution, you help me. ;)

Note: See TracTickets for help on using tickets.
Back to Top