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')
Make sure above virtual enviroment has all the necessary modules.
Your app should work in this virtual env before you continue.
Please read the page I link to on the bottom. The addsitedir should be
above sys.path.append(...your app)
>>
>> > import os
>> > os.environ['PYTHON_EGG_CACHE'] = '/usr/local/python2.4.5/python-eggs/'
Why is your egg cache in default python instalation, this should be in
your /home/uwe/...some/...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'
Why are you adding sbin to your path. site.addsitedir and
sys.path.append should be enough.
>> > os.environ['VIRTUAL_ENV'] = '/home/uwe/Projects/BTG1.1'
>> > os.environ['HOME'] = '/var/www'
>> > os.environ['LANG'] = 'en_US.UTF-8'
What are the above for? The app should figure it out on its own?.
>>
>> > 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
My guess is that you have mixed all the paths together and mod_wsgi
script doesn't know where to start looking for the toscawidget. You
need to clean up your configuration file.
>> 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.
>
Also read
http://lucasmanual.com/mywiki/TurboGears#head-6d3f2c73da40af50caff121f8670e5cb75ef49b8
especially the part about virtual env setup, and the order where
virtualenv parts is located in.
Thanks,
Lucas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---