On Wed, Jun 27, 2007 at 04:53:12PM +0200, Roodie wrote: > > I worked on a console application which uses django to do some > database related tasks. > I started my code with these lines: > > --- > > #!/usr/bin/env python > import sys > sys.path.append('/Library/Frameworks/Python.framework/Versions/2.4/ > lib/python2.4/site-packages/django') > sys.path.append('/path/to/the/application/directory/') > > import os > os.environ['DJANGO_SETTINGS_MODULE'] = 'applicationname.settings' > > --- > > From this point you can continue by importing the neccessary > libraries and writing your code. > > Maybe there is a better way of doing it but works perfeclty.
Have a look at django.conf.settings.configure: -------------------------------------------------------------------------------- from django.conf import settings settings.configure( INSTALLED_APPS = ( 'myappcontainingmodels', ), DEBUG = False ) -------------------------------------------------------------------------------- See: http://www.djangoproject.com/documentation/settings/#using-settings-without-setting-django-settings-module -Forest
signature.asc
Description: Digital signature