Re: Intial Data from Script

2008-04-09 Thread Thomas Guettler
Peter Rowell schrieb: > Are you asking how to run a standalone Django script? If so, the > following gives you a fully initialized Django environment. > > No, I want to run a python script if a database table gets created. The static sql/mymodel.sql files are not enough for my case. I found th

Re: Intial Data from Script

2008-04-08 Thread Peter Rowell
Are you asking how to run a standalone Django script? If so, the following gives you a fully initialized Django environment. standalone_script.py #!/usr/bin/env python from django.core.management import setup_environ import settings setup_environ(settings) # Your python/Django cod

Intial Data from Script

2008-04-08 Thread Thomas Guettler
Hi, how can I insert initial data from a script? Static SQL files don't work for my case. Background: I need to load some SQL (tsearch2 (postgresql)) if the database version is smaller than 8.3 ... Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler