2009/12/11 Val Shkolnikov <[email protected]>:
> Hi Graham,
>
> My modwsgi cannot find /error/style in the request "GET 
> /error/style/black.css HTTP/1.1" in the HelloWorld debugger example.  I get
>
> File does not exist: /var/www/error/style, referer: 
> http://pf-client1:8800/hello/debugger

What is generating this error, Apache or the Pylons code?

It looks a bit like Apache since /var/www mentioned, something the web
application wouldn't know about.

Seems to me like httpd-multilang-errordoc.conf has been enabled in
Apache configuration and so using:

Alias /error/ "/var/www/error/"

which is overriding WSGIScriptAlias for that URL subset.

You need to disable multilang error documents in Apache configuration.

Graham

> Note, that it works fine from the "paster serve" cmd and from the 
> simple_server.  Also, if I set debug = true in the development.ini, I get the 
> interactive debugger page just fine from modwsgi.
>
> My setup is below.  Thank you for your help!
> /Val
> ------------
> /etc/httpd/conf.d/wsgi.conf:
> ------------
> LoadModule wsgi_module modules/mod_wsgi.so
>
>  # place sockets here
> WSGISocketPrefix run/wsgi
>
> Listen 8800
> NameVirtualHost *:8800
> <VirtualHost *:8800>
>
>    ServerName pf-client1
>    LogLevel info
>
>      # Logfiles
>    ErrorLog logs/wsgi-error_log
>    CustomLog logs/wsgi-access_log common
>
>    DocumentRoot /var/www/wsgi
>    <Directory /var/www/wsgi>
>        Order deny,allow
>        Allow from all
>    </Directory>
>
>      # Setup mod_wsgi
>    WSGIScriptAlias / /var/www/wsgi/dispatch.wsgi
>      # Run wsgi as a single daemon process with 15 threads
>    WSGIDaemonProcess pf-client threads=15 display-name=%{GROUP}
>    WSGIProcessGroup pf-client
>
> </VirtualHost>
> ------------------
> /var/www/wsgi/dispatch.wsgi:
> ------------------
> # Add the virtual Python environment site-packages directory to the path
> import site
> site.addsitedir('/u0/home/vshkolni/performance/pyl/lib/python2.6/site-packages')
>
> import sys
> sys.path.append('/u0/home/vshkolni/performance/HelloWorld')
>
>  # Suppress Python 3 deprecation warning in ToscaWidgets (tw/core/view.py)
> from warnings import simplefilter
> simplefilter('ignore',DeprecationWarning,223)
>
> # Keep cache in Pylons dir
> import os
> os.environ['PYTHON_EGG_CACHE'] = '/var/www/wsgi/pylons/egg-cache'
> if __name__ == '__main__':
>  os.environ['PYTHON_EGG_CACHE'] = 
> '/u0/home/vshkolni/performance/HelloWorld/wsgi/pylons/egg-cache'
>
> # Load the Pylons application
> from paste.deploy import loadapp
> application = 
> loadapp('config:/u0/home/vshkolni/performance/HelloWorld/development.ini')
>
>    # test run as python /var/www/wsgi/dispatch.wsgi
> if __name__ == '__main__':
>  from wsgiref import simple_server
>  httpd = simple_server.WSGIServer(('',8000),simple_server.WSGIRequestHandler)
>  httpd.set_app(application)
>  httpd.serve_forever()
>
> -------------
> HelloWorld/development.ini:
> -------------
> [DEFAULT]
> debug = true
>
> [server:main]
> use = egg:Paste#http
> #host = 127.0.0.1
> host = pf-client1
> port = 5000
>
> [app:main]
> use = egg:HelloWorld
> full_stack = true
> static_files = true
>
> cache_dir = %(here)s/data
> beaker.session.key = helloworld
> beaker.session.secret = somesecret
>
> set debug = false
>
>
> # Logging configuration
> [loggers]
> keys = root, routes, helloworld
>
> [handlers]
> keys = console
>
> [formatters]
> keys = generic
>
> [logger_root]
> level = INFO
> handlers = console
>
> [logger_routes]
> level = INFO
> handlers =
> qualname = routes.middleware
> # "level = DEBUG" logs the route matched and routing variables.
>
> [logger_helloworld]
> level = DEBUG
> handlers =
> qualname = helloworld
>
> [handler_console]
> class = StreamHandler
> args = (sys.stderr,)
> level = NOTSET
> formatter = generic
>
> [formatter_generic]
> format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
> datefmt = %H:%M:%S
>
> -----------
> HelloWorld/helloworld/config/routing.py;
> -----------
> from pylons import config
> from routes import Mapper
>
> def make_map():
>    """Create, configure and return the routes Mapper"""
>    map = Mapper(directory=config['pylons.paths']['controllers'],
>                 always_scan=config['debug'])
>    map.minimization = False
>
>    # The ErrorController route (handles 404/500 error pages); it should
>    # likely stay at the top, ensuring it can always be resolved
>    map.connect('/error/{action}', controller='error')
>    map.connect('/error/{action}/{id}', controller='error')
>    map.connect('/error/{action}/{id}', controller='error')
>    map.connect('/var/www/error/{action}/{id}', controller='error')
>
>    # CUSTOM ROUTES HERE
>
>    map.connect('/', controller='hello', action='index')
>    map.connect('/{controller}/{action}')
>    map.connect('/{controller}/{action}/{id}')
>
>    return map
>
> ------------
> HelloWorld/helloworld/controllers/error.py
> ------------
> import cgi
>
> from paste.urlparser import PkgResourcesParser
> from pylons import request
> from pylons.controllers.util import forward
> from pylons.middleware import error_document_template
> from webhelpers.html.builder import literal
>
> from helloworld.lib.base import BaseController
>
> class ErrorController(BaseController):
>
>    def document(self):
>        """Render the error document"""
>        resp = request.environ.get('pylons.original_response')
>        content = literal(resp.body) or cgi.escape(request.GET.get('message', 
> ''
> ))
>        page = error_document_template % \
>            dict(prefix=request.environ.get('SCRIPT_NAME', ''),
>                 code=cgi.escape(request.GET.get('code', 
> str(resp.status_int))),
>
>                 message=content)
>        return page
>
>    def img(self, id):
>        """Serve Pylons' stock images"""
>        return self._serve_file('/'.join(['media/img', id]))
>
>    def style(self, id):
>              """Serve Pylons' stock stylesheets"""
>        return self._serve_file('/'.join(['media/style', id]))
>
>    def _serve_file(self, path):
>        """Call Paste's FileApp (a WSGI application) to serve the file
>        at the specified path
>        """
>        request.environ['PATH_INFO'] = '/%s' % path
>        return forward(PkgResourcesParser('pylons', 'pylons'))
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" 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/modwsgi?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en.


Reply via email to