If you set your environment variable DJANGO_SETTINGS_MODULE in the environment your script is running in, you need only add this line to your script (in addition to your model imports, of course).
from django.conf import settings Otherwise you'll need to import the OS module in your script and add a line like this: os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' Note that, in either case, you need to ensure that the proper path has been added to your PYTHONPATH. More detail, since you said you weren't quite a Python pro yet. Prerequisite Ensure that your project folder is on your PYTHONPATH. Example: #at the command line, not in your script export PYTHONPATH=/home/name/projects:$PYTHONPATH Solution #1: #at the command line, not in your script export DJANGO_SETTINGS_MODULE='myproject.settings' Now you can just do this in your script: from django.conf import settings Solution #2: #in your script, not on the command line import os os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' To me, solution 1 is easier, and cleaner, because if you change your settings file you don't have to change all your scripts. However, you may not have the ability to change the environment if you have multiple Django projects and don't want to break all the other ones. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.