Django 1.4 default database required?

173 views
Skip to first unread message

Optimus Paul

unread,
Apr 2, 2012, 11:35:28 AM4/2/12
to Django developers
I've been running Django for quite a while without a "database", we
use MongoDB, and it has worked well for us. We upgraded to 1.4 and
found that suddenly a default database is required. Is there a reason
for this? Or is this a bug?

We get the error when importing django.shortcuts.render_to_response,
which doesn't seem like the kind of place a database connection would
even be required.

ptone

unread,
Apr 2, 2012, 12:30:23 PM4/2/12
to django-d...@googlegroups.com
Any chance you have an explicit empty DATABASES={} setting? Try deleting that setting entirely and see if it works.

As part of the removal of the backwards compatibility shim for the old DATABASE_* settings, the global settings contains a DATABASES setting that uses the dummy backend for the default database.  This global setting will silence the import errors, but still raise an error if you try to do anything that uses the DB. 

-Preston




Paul DeCoursey

unread,
Apr 2, 2012, 1:46:12 PM4/2/12
to django-d...@googlegroups.com
Thanks,

I did look at it, it was the import of the Manager for the other shortcuts that was causing the issue. I'll try and file a bug for this.

Paul

On Apr 2, 2012, at 12:42 PM, Carl Meyer wrote:

> On 04/02/2012 09:35 AM, Optimus Paul wrote:
>> I've been running Django for quite a while without a "database", we
>> use MongoDB, and it has worked well for us. We upgraded to 1.4 and
>> found that suddenly a default database is required. Is there a reason
>> for this? Or is this a bug?
>

> Preston has the right solution for this - delete your DATABASES setting
> entirely. I think it would be best if an empty DATABASES setting had the
> same effect, especially since that's how it was in 1.3 - if you'd be
> willing to file a ticket for that, that'd be great.


>
>> We get the error when importing django.shortcuts.render_to_response,
>> which doesn't seem like the kind of place a database connection would
>> even be required.
>

> render_to_response doesn't require a database, but there are other
> functions in django.shortcuts that do (e.g. get_object_or_404), and the
> error is triggered on any import of django.db.*
>
> Carl
>

Carl Meyer

unread,
Apr 2, 2012, 1:42:16 PM4/2/12
to django-d...@googlegroups.com
On 04/02/2012 09:35 AM, Optimus Paul wrote:
> I've been running Django for quite a while without a "database", we
> use MongoDB, and it has worked well for us. We upgraded to 1.4 and
> found that suddenly a default database is required. Is there a reason
> for this? Or is this a bug?

Preston has the right solution for this - delete your DATABASES setting


entirely. I think it would be best if an empty DATABASES setting had the
same effect, especially since that's how it was in 1.3 - if you'd be
willing to file a ticket for that, that'd be great.

> We get the error when importing django.shortcuts.render_to_response,


> which doesn't seem like the kind of place a database connection would
> even be required.

render_to_response doesn't require a database, but there are other

signature.asc
Reply all
Reply to author
Forward
0 new messages