On Mon, Dec 1, 2008 at 5:22 PM, Graham Dumpleton <[EMAIL PROTECTED]
> wrote:
>
>
>
> On Dec 2, 9:11 am, "Ken Kuhlman" <[EMAIL PROTECTED]> wrote:
> > On Thu, Nov 27, 2008 at 2:09 PM, Uwe C. Schroeder <[EMAIL PROTECTED]>
> wrote:
> >
> >
> >
> > > Hello everyone,
> >
> > > I've tried running a working TG 1.5 app under mod_wsgi.
> > > When I start the application with the "start_application.py" script,
> > > everything is peachy.
> > > However, when I start the same application in mod_wsgi, toscawidgets is
> not
> > > initialized as tool, so cherrypy throws an error:
> > > AttributeError: 'Toolbox' object has no attribute 'toscawidgets'
> >
> > > So I dug around in the code and I found that the start_extension method
> in
> > > toscawidgets.mods.tg is never called, although the file is imported
> >
> > ToscaWidgets registers itself as a TurboGears extension via the
> setuptools
> > entry point
> > "turbogears.extensions". These are run in TG's startup.startTurboGears.
> >
> >
> >
> > > This is my wsgi start script (this is TG 1.5 with Cherrypy 3.1):
> >
> > > import sys
> > > sys.path.append('/home/uwe/Projects/BTG1.1/bunspace')
> > > sys.stdout = sys.stderr
> >
> > > import site
> > >
> site.addsitedir('/home/uwe/Projects/BTG1.1/lib/python2.4/site-packages')
> >
> > > import os
> > > os.environ['PYTHON_EGG_CACHE'] = '/usr/local/python2.4.5/python-eggs/'
> > > os.environ['PATH']
> > > =
> > >
> '/home/uwe/Projects/BTG1.1/bin:/usr/local/python2.4.5/bin:/usr/bin:/sbin:/u
> sr/sbin:/usr/local/bin'
> > > os.environ['VIRTUAL_ENV'] = '/home/uwe/Projects/BTG1.1'
> > > os.environ['HOME'] = '/var/www'
> > > os.environ['LANG'] = 'en_US.UTF-8'
> >
> > > import atexit
> > > import threading
> > > import cherrypy
> > > import turbogears
> >
> > >
> turbogears.update_config(configfile="/home/uwe/Projects/BTG1.1/bs/dev.cfg",
> > > modulename="bs.config")
> > > turbogears.config.update({'global': {'server.environment':
> 'development'}})
> > > turbogears.config.update({'global': {'autoreload.on': False}})
> > > turbogears.config.update({'global': {'server.log_to_screen': True}})
> >
> > > import bs.controllers
> > > application=cherrypy.tree.mount(bunspace.controllers.Root(),'/')
> >
> > > Can anyone tell me why toscawidgets isn't initialized although I have
> > > toscawidgets.on=True
> > > tools.toscawidgets.on=True
> >
> > > in the app config and the application starts fine without mod_wsgi
> >
> > > Thanks and happy Turkey Day
> >
> > > Uwe
> >
> > When you're running standalone, you're probably using start_server, which
> > calls startTurboGears & starts the extensions.
> >
> > Try adding a call to startup.startTurboGears in your mod_wsgi start
> script.
>
> Can someone confirm this and indicate where in script described at:
>
> http://code.google.com/p/modwsgi/wiki/IntegrationWithTurboGears
>
> would be most appropriate place to put it.
>
> If have details can then update the documentation.
>
> Also, which versions of TG does this apply to? is it everything
> <TG2.0?
>
> Graham
>
I looked deeper & saw that this wasn't necessary in 1.1 since it sets up the
callback during the import. I corrected 1.5 in r5811 to mimic that
behavior; you can ignore the recommendation I made yesterday.
Uwe, can you svn up & try your original code again?
Graham, thanks for keeping me honest. :-)
-Ken
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---