views:

717

answers:

3

Can I have a custom service providing the storage of the models I use in Django? That service would not be speaking SQL.

I would like to build a web frontend to a system that consists of multiple services linked with a network based IPC, one of which provides an interface to commonly used, persistent objects (stored in a database).

The real question here is not whether it's possible but whether it would make sense. For example, if I end up inheriting models.Model and overwriting every single method, skipping all the rest of django.db, I guess it wouldn't.

The object service might even end up being implemented in Django, too, but the communication between it and the web frontend would not be using SQL.

+1  A: 

I think you want to write a custom database backend and then use it via the DATABASE_ENGINE setting. Models will pick it up automatically then.

I couldn't find good docs, but I'd start here:

http://djangoapi.matee.net/django.db-module.html

The Django source code is quite readable.

Lou Franco
+5  A: 

You might take a look at An introduction to using couchdb with django. Dunno if connecting to CouchDB is directly something that interests you, but this is a pretty good example of how to use django to connect to a RESTful webservice.

Jason Baker
A: 

A variation on the question above.

I want to have a specific model that is unmanaged by DB back-end the DATABASE_ENGINE setting while other models remain managed by django's ORM layer.

For example consider an app that uses AWS queues and MySQL with a bunch of models. One would want to have Queues in admin UI and be able to obtain the list of queues and do operations on queues via a sub-set of the Model API.

Alexis