On Sep 5, 2007, at 2:45 PM, neich wrote:

I am playing with the pylons framework and I have found something I
don't know how to do it. I would like  to write a python script that
can access the models of my app, by I want to execute directly, not
through a controller. For example, I would like to have a crontab
process that perform some peridocal operations on my databse.

I have tried some "Import" combinations, but I have not managed to do
it.

You'll need to know where your config ini file is, and load your app from the script. Your websetup.py script in your project should have code to do this (in 0.9.6 it does). If it doesn't, you'll need to run this first before importing your models (again, this works in 0.9.6):

from paste.deploy import appconfig
from pylons import config

from YOURPROJECT.config.environment import load_environment

conf = appconfig('config:' +'/wherever/your/config.ini')
load_environment(conf.global_conf, conf.local_conf)

import YOURPROJECT.model as model

etc.

Cheers,
Ben

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to