[Solved]-Django ORM for desktop application


The Django people are sensible people with a philosophy of decoupling things. So yes, in theory you should be perfectly able to use Django’s ORM in a standalone application.

Here’s one guide I found: Django ORM as a standalone component.


I would suggest using SQLAlchemy and a declarative layer on top of it such as Elixir if you prefer a Django-like syntax.


Yes it is. The Commonsense Computing Project at the MIT media lab does that for ConceptNet,
a semantic network. You can get the source here: http://pypi.python.org/pypi/ConceptNet/4.0b3


The peewee ORM has a declarative syntax that should be familiar to django users, and can be used as a standalone. Here are the project docs


I would suggest another ORM for a desktop application maybe SQLAlchemy or SQLObject.
It i possible to use the django ORM but I think other ORM are a better ones if you are going to use them standalone.



Camelot seems promising if you want to do Python desktop apps using a DB. It uses SQLAlchemy though. Haven’t tried it yet.



This is possible and is documented in the docs here:

You need to setup django like below:

import django
from django.conf import settings
from myapp import myapp_defaults

settings.configure(default_settings=myapp_defaults, DEBUG=True)

# Now this script or any imported module can use any part of Django it needs.
from myapp import models

Leave a comment