Opened 15 years ago

Closed 15 years ago

Last modified 11 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

Description

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/basehttp.py", line 279, in run
    self.result = application(self.environ, self.start_response)

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

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

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/middleware.py", line 36, in process_response
    request.session.save()

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

  File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py", 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/base.py", 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/db.py", line 25, in exists
    Session.objects.get(session_key=session_key)

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

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

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

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

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

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

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", 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/query.py", line 740, in get_columns
    col_aliases)

  File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", 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/query.py", 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/base.py", 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 (http://codeigniter.com/) and make yours more easier to understand?

Best regards, Qian Xu

Change History (3)

comment:1 by dc, 15 years ago

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 by Qian Xu, 15 years ago

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

in reply to:  2 comment:3 by NeoOrion, 11 years ago

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