I have a script which uses the Django ORM features, amongst other external libraries, that I want to run outside of Django (that is, executed from the command-line).
from import settings #your project settings file
from django.core.management import setup_environ #environment setup function
setup_environ(settings)
#Rest of your django imports and code go here