Usually the callable 'application' needs to be the last statement in your hook file. What are you trying to do with
import paste.fixture app = paste.fixture.TestApp(application) app.get("/") This for some reason this doesn't sit right with me. The 'application' callable will be seen by mod_wsgi before any code after it can do anything useful. Graham, lives in Australia, so he won't be online for a few hours yet. ~Carl On Tue, Apr 20, 2010 at 12:18 PM, noisebleed <vitorbrandao...@gmail.com> wrote: > I have gatekeeper.wsgi outside the egg. This file is known to apache/ > mod_wsgi by setting the following line in the respective vhost config > file: > WSGIScriptAlias / /var/www/modwsgi/gatekeeper/gatekeeper.wsgi > > Btw, here is what gatekeeper.wsgi looks like: > # ---------------------------------------------- > import os, sys > sys.path.append('/var/www/gatekeeper') > > os.environ['PYTHON_EGG_CACHE'] = '/var/www/modwsgi/python-eggs' > > from paste.script.util.logging_config import fileConfig > fileConfig('/var/www/modwsgi/gatekeeper/production.ini') > > from paste.deploy import loadapp > application = loadapp('config:/var/www/modwsgi/gatekeeper/ > production.ini') > > import paste.fixture > app = paste.fixture.TestApp(application) > app.get("/") > # ---------------------------------------------- > > If you detect something wrong in the above code please make me know ;) > > Just to make it clear: > * wsgi files are in /var/www/mod_wsgi/gatekeeper/ > * the webapp is in /var/www/gatekeeper (which is a symlink to /usr/lib/ > python2.6/site-packages/GateKeeper-0.1dev-py2.6.egg/gatekeeper). > > Thanks again. > > On 20 Abr, 17:02, Carl Nobile <carl.nob...@gmail.com> wrote: >> There should be one file that has a callable in it that mod_wsgi uses >> to start everything. The callqbles name must be 'application' unless >> you have set it differently in your apache conf file. This file (the >> hook file) I think must be outside the egg or mod_wsgi will not find >> it. >> >> ~Carl >> >> On Tue, Apr 20, 2010 at 11:30 AM, noisebleed <vitorbrandao...@gmail.com> >> wrote: >> > Thanks for helping out Carl. >> >> > The wsgi folder is not included in the egg I've built on the personal >> > machine. Is that what you're refering to? If not, can you elaborate >> > please. I'm still not familiar with a lot of concepts... >> >> > On 20 Abr, 16:23, Carl Nobile <carl.nob...@gmail.com> wrote: >> >> I'm not sure here, but if you have put the wsgi hook file in the egg >> >> it may not be found by mod_wsgi. This is not my area of expertise, >> >> just an educated guess as to what your issue may be. >> >> >> ~Carl >> >> >> On Tue, Apr 20, 2010 at 10:42 AM, noisebleed <vitorbrandao...@gmail.com> >> >> wrote: >> >> > Hi all. First message sent to modwsgi mailing list. >> >> >> > I've built a small web application with TurboGears2 and tested it >> >> > inside a virtualenv (on my personal machine) with "paster serve >> >> > development.ini". Works just fine. >> >> >> > Then I built an Egg and installed system-wide on my server. Defined a >> >> > new Apache2 vhost and configured both Apache and the wsgi script >> >> > created by modwsgideploy. After some adjustments I'm stuck with the >> >> > message in the email subject. When visiting my URL Apache shows "500 >> >> > Internal Server Error". >> >> >> > Here goes an excerpt from Apache error log: >> >> >> > [info] Initial (No.1) HTTPS request received for child 1 (server >> >> > gatekeeper.localhost:443) >> >> > [info] mod_wsgi (pid=21618): Create interpreter 'gatekeeper.localhost: >> >> > 50000|'. >> >> > [info] [client 192.168.1.103] mod_wsgi (pid=21618, >> >> > process='gatekeeper', application='gatekeeper.localhost:50000|'): >> >> > Loading WSGI script '/var/www/modwsgi/gatekeeper/ >> >> > gatekeeper.wsgi'. >> >> > [error] 15:54:44,649 DEBUG [pylons.configuration] Initializing >> >> > configuration, package: >> >> > 'gatekeeper' >> >> > [error] 15:54:44,651 DEBUG [pylons.configuration] Pushing process >> >> > configuration >> >> > [error] 15:54:44,681 DEBUG [pylons.configuration] Adding mako engine >> >> > with alias None and {'mako.directories': ['/usr/lib/python2.6/site- >> >> > packages/GateKeeper-0.1dev-py2.6.egg/gatekeeper/templates'], >> >> > 'myghty.component_root': [{'templates': '/usr/lib/python2.6/site- >> >> > packages/GateKeeper-0.1dev-py2.6.egg/gatekeeper/templates'}], >> >> > 'myghty.data_dir': '/var/www/modwsgi/gatekeeper/data/templates', >> >> > 'kid.encoding': 'utf-8', 'kid.assume_encoding': 'utf-8', >> >> > 'mako.module_directory': '/var/www/modwsgi/gatekeeper/data/templates', >> >> > 'myghty.allow_globals': ['c', 'config', 'g', 'h', 'render', 'request', >> >> > 'session', 'translator', 'ungettext', '_', 'N_'], >> >> > 'myghty.output_encoding': 'utf-8', 'myghty.raise_error': True, >> >> > 'mako.output_encoding': 'utf-8', 'mako.filesystem_checks': True} >> >> > options >> >> > [error] 15:54:44,682 DEBUG [pylons.configuration] Loaded mako template >> >> > engine as the default template >> >> > renderer >> >> > [error] 15:54:44,931 DEBUG [pylons.templating] Initialized Buffet >> >> > object >> >> > [error] 15:54:44,933 DEBUG [pylons.templating] Adding mako template >> >> > language for use with >> >> > Buffet >> >> > [error] 15:54:44,934 DEBUG [routes.middleware] Initialized with method >> >> > overriding = True, and path info altering = >> >> > True >> >> > [error] 15:54:45,025 DEBUG [txn.-1335477392] new >> >> > transaction >> >> > [error] 15:54:45,035 DEBUG [routes.middleware] Matched >> >> > GET / >> >> > [error] 15:54:45,036 DEBUG [routes.middleware] Route path: '*url', >> >> > defaults: {'action': u'routes_placeholder', 'controller': >> >> > u'root'} >> >> > [error] 15:54:45,037 DEBUG [routes.middleware] Match dict: {'url': >> >> > u'/', 'action': u'routes_placeholder', 'controller': >> >> > u'root'} >> >> > [error] 15:54:45,038 DEBUG [pylons.wsgiapp] Setting up Pylons stacked >> >> > object >> >> > globals >> >> > [error] 15:54:45,040 DEBUG [pylons.wsgiapp] Setting up paste testing >> >> > environment >> >> > variables >> >> > [error] 15:54:45,041 DEBUG [pylons.wsgiapp] Resolved URL to >> >> > controller: >> >> > u'root' >> >> > [error] 15:54:45,088 DEBUG [tw.core.resources] Registered static at / >> >> > tw.forms/ >> >> > static >> >> > [error] 15:54:45,092 DEBUG [tw.core.resources] Registered static/ >> >> > calendar at /tw.forms/static/ >> >> > calendar >> >> > [error] 15:54:45,183 DEBUG [tg.wsgiapp] Found controller, module: >> >> > 'gatekeeper.controllers.root', class: >> >> > 'RootController' >> >> > [error] 15:54:45,184 DEBUG [pylons.wsgiapp] Controller appears to be a >> >> > class, instantiating >> >> >> > (...) >> >> >> > [error] 15:54:45,192 INFO [tg.i18n] Set request language to >> >> > [] >> >> > [error] 15:54:45,194 INFO [tg.i18n] Language []: not supported by >> >> > FormEncode >> >> > [error] 15:54:45,195 DEBUG [tg.controllers] No controller-wide >> >> > authorization >> >> > at / >> >> > [error] 15:54:45,198 DEBUG [pylons.controllers.core] Merging >> >> > pylons.response headers into start_response call, status: 404 Not >> >> > Found >> >> > [error] 15:54:45,201 DEBUG [txn.-1335477392] >> >> > commit >> >> > [error] 15:54:45,202 DEBUG [tg.configuration] Removing DBSession from >> >> > current >> >> > thread >> >> > [error] 15:54:45,203 DEBUG [txn.-1335477392] new >> >> > transaction >> >> > [error] 15:54:45,208 DEBUG [routes.middleware] Matched GET /error/ >> >> > document >> >> > [error] 15:54:45,209 DEBUG [routes.middleware] Route path: '*url', >> >> > defaults: {'action': u'routes_placeholder', 'controller': >> >> > u'root'} >> >> > [error] 15:54:45,210 DEBUG [routes.middleware] Match dict: {'url': u'/ >> >> > error/document', 'action': u'routes_placeholder', 'controller': >> >> > u'root'} >> >> > [error] 15:54:45,211 DEBUG [pylons.wsgiapp] Setting up Pylons stacked >> >> > object >> >> > globals >> >> > [error] 15:54:45,212 DEBUG [pylons.wsgiapp] Setting up paste testing >> >> > environment >> >> > variables >> >> > [error] 15:54:45,214 DEBUG [pylons.wsgiapp] Resolved URL to >> >> > controller: >> >> > u'root' >> >> > [error] 15:54:45,215 DEBUG [pylons.wsgiapp] Controller appears to be a >> >> > class, >> >> > instantiating >> >> > [error] 15:54:45,216 DEBUG [pylons.wsgiapp] Calling controller class >> >> > with WSGI interface >> >> >> > (...) >> >> >> > [error] 15:54:45,223 INFO [tg.i18n] Set request language to [] >> >> > [error] 15:54:45,225 INFO [tg.i18n] Language []: not supported by >> >> > FormEncode >> >> > [error] 15:54:45,226 DEBUG [tg.controllers] No controller-wide >> >> > authorization at /error/document >> >> > [error] 15:54:45,229 DEBUG [pylons.controllers.core] Merging >> >> > pylons.response headers into start_response call, status: 404 Not >> >> > Found >> >> > [error] 15:54:45,231 DEBUG [txn.-1335477392] commit >> >> > [error] 15:54:45,232 DEBUG [tg.configuration] Removing DBSession from >> >> > current thread >> >> > [error] [client 192.168.1.103] mod_wsgi (pid=21618): Target WSGI >> >> > script '/var/www/modwsgi/gatekeeper/gatekeeper.wsgi' cannot be loaded >> >> > as Python module. >> >> > [error] [client 192.168.1.103] mod_wsgi (pid=21618): Exception >> >> > occurred processing WSGI script '/var/www/modwsgi/gatekeeper/ >> >> > gatekeeper.wsgi'. >> >> > [error] [client 192.168.1.103] Traceback (most recent call last): >> >> > [error] [client 192.168.1.103] File "/var/www/modwsgi/gatekeeper/ >> >> > gatekeeper.wsgi", line 55, in <module> >> >> > [error] [client 192.168.1.103] app.get("/") >> >> > [error] [client 192.168.1.103] File "/usr/lib/python2.6/site- >> >> > packages/Paste-1.7.3-py2.6.egg/paste/fixture.py", line 208, in get >> >> > [error] [client 192.168.1.103] return self.do_request(req, >> >> > status=status) >> >> > [error] [client 192.168.1.103] File "/usr/lib/python2.6/site- >> >> > packages/Paste-1.7.3-py2.6.egg/paste/fixture.py", line 406, in >> >> > do_request >> >> > [error] [client 192.168.1.103] self._check_status(status, res) >> >> > [error] [client 192.168.1.103] File "/usr/lib/python2.6/site- >> >> > packages/Paste-1.7.3-py2.6.egg/paste/fixture.py", line 439, in >> >> > _check_status >> >> > [error] [client 192.168.1.103] res.body)) >> >> > [error] [client 192.168.1.103] AppError: Bad response: 404 Not Found >> >> > (not 200 OK or 3xx redirect for /) >> >> > [error] [client 192.168.1.103] 404 Not Found >> >> > [error] [client 192.168.1.103] >> >> > [error] [client 192.168.1.103] The resource could not be found. >> >> > [error] [client 192.168.1.103] >> >> > [error] [client 192.168.1.103] >> >> > [debug] ssl_engine_kernel.c(1893): OpenSSL: Write: SSL negotiation >> >> > finished successfully >> >> > [info] [client 192.168.1.103] Connection closed to child 1 with >> >> > standard shutdown (server gatekeeper.localhost:443) >> >> >> > As I'm fresh to TurboGears2 and modwsgi I could use some help here. >> >> > Thanks! >> >> >> > PS: I can post my vhost config, gatekeeper.wsgi script and >> >> > production.ini if requested. Just don't want to stuff more text in >> >> > this already long email :) >> >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups "modwsgi" group. >> >> > To post to this group, send email to modw...@googlegroups.com. >> >> > To unsubscribe from this group, send email to >> >> > modwsgi+unsubscr...@googlegroups.com. >> >> > For more options, visit this group >> >> > athttp://groups.google.com/group/modwsgi?hl=en. >> >> >> -- >> >> ------------------------------------------------------------------------------- >> >> Carl J. Nobile (Software Engineer) >> >> carl.nob...@gmail.com >> >> ------------------------------------------------------------------------------- >> >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> >> "modwsgi" group. >> >> To post to this group, send email to modw...@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> modwsgi+unsubscr...@googlegroups.com. >> >> For more options, visit this group >> >> ... >> >> mais informações » > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to modw...@googlegroups.com. > To unsubscribe from this group, send email to > modwsgi+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- ------------------------------------------------------------------------------- Carl J. Nobile (Software Engineer) carl.nob...@gmail.com ------------------------------------------------------------------------------- -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modw...@googlegroups.com. To unsubscribe from this group, send email to modwsgi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.