I typically prefer to run these kinds of things outside the web app
itself, usually with a Python script called from a cron job. You can
access your app's settings and DB by creating a package and putting
code like this in the __init__.py:

from paste.deploy import appconfig
from pylons import config

from synapse.config.environment import load_environment

conf = appconfig('config:' + '/<path to app here>/development.ini')
load_environment(conf.global_conf, conf.local_conf)

from <app name here>.model import *

Then importing that package in the script that performs the task.

-Hollister

On Oct 6, 10:54 am, Alec Munro <alecmu...@gmail.com> wrote:
> I think that may have been just what I needed. When I started this
> project, it was stateless, not using a database. I added the database
> afterwards, but I didn't change the basecontroller.
>
> Got to clean some things up. :)
>
> Thanks!
>
> On Oct 6, 10:45 am, Graham Higgins <gjh...@bel-epa.com> wrote:
>
>
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
>
> > On 5 Oct 2010, at 14:40, Alec Munro wrote:
>
> > > I generally don't do anything to
> > > close the session. Should I? If so, what?
>
> > You could try "Session.remove()" as per:
>
> >http://bitbucket.org/bbangert/pylons/src/tip/pylons/templates/default...
>
> > - --
> > Cheers,
>
> > Graham
>
> >http://www.linkedin.com/in/ghiggins
>
> > -----BEGIN PGP SIGNATURE-----
>
> > iEYEARECAAYFAkysfVwACgkQOsmLt1NhivwnXACg7H2YAlYLkKLfFXceNQY5gCg9
> > vd4AnjmbVlEt4HIj/WMxhFaFkm9dInIuiQCVAgUBTKx9XFnrWVZ7aXD1AQJXhgP9
> > E+6ZqIAjruGbagITQ3Fc2T6xtix3EbLtSBQkUUi2GQxLw+uJJlAyYPJHha6o9CZK
> > T0YPGKFRRJBabu8LmyWkEUpAtwRc2C0QPKxXCFiAJ0+RxHrOjz69AiFcf15KGt3F
> > iougOWVT5GmgpRcT0Mrr8VXKJhntZky5Nnhs3osbfGk=
> > =8Xqk
> > -----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to