On Aug 23, 1:54 pm, Oivvio Polite <oiv...@polite.se> wrote:
> Following advice on this list I've moved to virtualenv+pip to manage my
> django stack, which so far is working out nicely.
>
> But what should I do about standalone scripts? Say I have a project

You need to load up the current project environment at the top of your
script. I find this works well when running a script from the project
root directory, e.g.

$ cd proj_dir
$ python scripts/somescript.py

and with this at the top of the script:

# Set up Django environment
import sys,os

# These could be absolute rather than relative paths:
sys.path.append('.')
sys.path.append('../')
sys.path.append('../lib/python2.5/site-packages/django')

os.environ['DJANGO_SETTINGS_MODULE'] ='someproj.settings'

from django.core.management import setup_environ
from someproj import settings
setup_environ(settings)

./s

-- 
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.

Reply via email to