Alexander,

Try use this

#test.py
import os, sys
sys.path.append('../')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'

myproject/test.py


On 07/18/2011 09:34 AM, Alexander Crössmann wrote:
Hi,

I want to write a python script that works with django models without
runing the server. My OS ist Ubuntu 10.10.

My skipt looks as follows:

import sys
sys.path.append('/home/myname/python/django_projects/')
sys.path.append('/home/myname/python/')
import settings
from django_projects.codierung.models import *

The settings work fine with testserver and apache but wenn I run the
that skript I geht the following error:

ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

What else do I need to define appart from the stuff that is allready in
the settings file? I read the page on settings in the documentation but
that wouldn't help me.

Thanks for any Help!
Alex


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