[Solved]-Django ORM for desktop application

12👍

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.

4👍

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

3👍

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

1👍

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

0👍

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.

👤Ferran

0👍

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

👤Macke

0👍

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)
django.setup()

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

Leave a comment