eval(WsgiApplication)

Graham Dumpleton Graham.Dumpleton at gmail.com
Sun May 3 00:58:21 EDT 2009


On May 2, 10:15 pm, Дамјан Георгиевски <gdam... at gmail.com> wrote:
> >> > How do I do this in python3?
>
> >> What's wrong with importing it?
>
> > The problem is that my wsgi files have a wsgi extention for mod_wsgi
> > use
> ..
> > mod_wsgi has a .wsgi handler because it is recommended to rename the
> > wsgi file with wsgi extensions to avoid double imports
> > cherrypy server has a dispatcher class
>
> You can either use .py extension for the wsgi files OR use a custom
> importer that can import your .wsgi fileshttp://docs.python.org/library/modules.html

You don't have to go to such an extreme if it is only for one file to
be used as root WSGI application. Can use something like:

  def load_script(filename, label='__wsgi__'):
    module = imp.new_module(label)
    module.__file__ = filename
    execfile(filename, module.__dict__)
    return module

  module = load_script('/some/path/file.wsgi')

  application = module.application

Graham



More information about the Python-list mailing list