I have a similar but not the same need. I do use the full Django stack,
but I need to write helper programs that can interact with the database
but have nothing to do with the web. This matters because I already
have a normal Django project and some apps set up, but you may need to
make a dummy project and app for this to work. (Not really dummy, since
the models.py file will require real classes.)

To achieve this, I have to put the folder containing the project
folder, as well as the django_src folder, on my python path. Then, add
the following three lines at the beginning of the python program:

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
from myproject.myapp.models import Model1, Model2

Now you can access and manipulate the database associated with your
project settings.

I may be forgetting something here, but this is approximately how I've
done it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to