tags:

views:

42

answers:

1

how do i import classes from a pylons project for maintenance scripts?

+1  A: 

Maybe this could be interesting to you:

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

Source: Ben Bangert http://groups.google.com/group/pylons-discuss/browse_thread/thread/90c47dc6120fa43d/52f25a08f7234fa7

Antoine Leclair