Opened 14 years ago

Closed 14 years ago

#14022 closed (worksforme)

context_processors debug() Fails with no DB Backend

Reported by: dvine Owned by: nobody
Component: Core (Other) Version: 1.2
Severity: Keywords: sprintdec2010
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If no database backend is defined the debug() function of djnago.core.context_processors fails at:

context_extras['sql_queries'] = connection.queries

because the 'DatabaseWrapper' object has no attribute 'queries'

This happens in my pip install of Django 1.2.1 on my Linux Server but not in my recent trunk checkout on my Windows djago dev server.

Change History (1)

comment:1 by Julien Phalip, 14 years ago

Keywords: sprintdec2010 added
Resolution: worksforme
Status: newclosed

If you do not specify any DATABASE_XXXX settings then the connection is set to a django.db.backends.dummy.base.DatabaseWrapper instance, which does have a queries attribute (an empty list). Therefore no exception is raised in this context processor. For that reason (and after discussing this with russellm) I'm closing this as worksforme.

I do not doubt you're having an issue with this, but if you'd like it to be addressed you need to provide more information about how to reproduce it:

  • What do you mean by "the debug() function fails at"? What exception is raised?
  • What do you mean by "if no database backend is defined"? As I said, if you do not specify any database settings then it should just work. So what are you doing to disable (or not enable) the database backend in your project?
Note: See TracTickets for help on using tickets.
Back to Top