[Dev-flock] ideas for referencing our db.models outside of django?
Lucy Mendel
lucy at thoughtandmemory.org
Wed May 14 12:38:10 EDT 2008
yo,
I'm trying to get one of our application's Node objects outside of our
Django app. Maybe this is the wrong way to go about cellphone
integration. It seems like a fine idea: import application and
settings stuff; use API to get a node (eventually, do search? not sure
how to do that yet). Problem is, even though the DATABASE_ENGINE is
defined, Django doesn't think it is. I've tried importing more django
things, but I get the same error.
Does something obvious strike you? Alternate ideas for how these
systems should relate?
/var/sites/cellphone_staging/prototype $ export
PYTHONPATH=/var/sites/hm_staging:/var/sites/cellphone_sta
/prototype:/usr/local/django_src/django
/var/sites/cellphone_staging/prototype $ export
DJANGO_SETTINGS_MODULE=/var/sites/cellphone_staging/prototype
/var/sites/cellphone_staging/prototype $ python
Python 2.4.4 (#2, Apr 5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from settings import *
>>> from db.models import *
>>> Node
<class 'db.graph.Node'>
>>> Node.objects.get(id=2)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/django/db/models/manager.py",
line 69, in get
return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 261, in get
obj_list = list(clone)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 114, in __iter__
return iter(self._get_data())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 483, in _get_data
self._result_cache = list(self.iterator())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 180, in iterator
select, sql, params = self._get_sql_clause()
File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 491, in _get_sql_clause
select = ["%s.%s" % (qn(opts.db_table), qn(f.column)) for f in opts.fields]
File "/usr/lib/python2.4/site-packages/django/db/backends/dummy/base.py",
line 14, in complain
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE
setting yet."
django.core.exceptions.ImproperlyConfigured: You haven't set the
DATABASE_ENGINE setting yet.
>>> DATABASE_ENGINE
'mysql'
>>>
More information about the Dev-flock
mailing list