On Mar 16, 7:13 pm, dave <[email protected]> wrote:
> I've got a basic application running using web.py's development web
> server, and would like to take a look at it running under a real web
> server... I'm going with Apache combined w/ mod_python running under
> Windows for now (unfortunately).
>
> I've got a vanilla install of Apache 2.2 on Windows, mod_python 3.3.1,
> Python 2.5, and web.py 0.31. I've confirmed that mod_python is
> functional on its own, but am having problems getting my app up and
> running on mod_python & Apache. To get things down to their simplest,
> I copied the "Hello World" example and saved it as "codep.py" in
> Apache's htdocs directory:
Do no put it in the htdocs directory, you do not have to and it is bad
practice, put it somewhere else. Then add the directory it is in to
PythonPath directory in Apache configuration.
PythonPath '["/some/path/to/directory/where/you/put/it"]+ sys.path'
Graham
> import web
> urls = ( '/(.*)', 'hello' )
> class hello:
> def GET(self, name):
> if not name:
> name = 'world'
> return 'Hello, ' + name + '!'
>
> main = web.wsgifunc(web.webpyfunc(urls, globals()))
>
> ... added the following lines to the relevant <Directory> directive in
> Apache's config, as outlined in the install instructions...
>
> AddHandler python-program .py
> PythonHandler wsgiref.modpython_gateway::handler
> PythonOption wsgi.application codep::main
>
> ... and put modpython_gateway in the wsgi directory of my Python
> library
>
> When hittinghttp://localhost:8080/test.py/, the following gets dumped
> to Apache's error log:
>
> URI: '/codep.py/'
> Location: None
> Directory: 'C:/Program Files/Apache Software Foundation/Apache2.2/
> htdocs/'
> Filename: 'C:/Program Files/Apache Software Foundation/Apache2.2/
> htdocs/codep.py'
> PathInfo: '/'
> Traceback (most recent call last):
> File "C:\\Python25\\Lib\\site-packages\\mod_python\\importer.py",
> line 1537, in HandlerDispatch\n default=default_handler, arg=req,
> silent=hlist.silent)
> File "C:\\Python25\\Lib\\site-packages\\mod_python\\importer.py",
> line 1229, in _process_target\n result = _execute_target(config,
> req, object, arg)
> File "C:\\Python25\\Lib\\site-packages\\mod_python\\importer.py",
> line 1128, in _execute_target\n result = object(arg)
> File "C:\\Python25\\Lib\\wsgiref\\modpython_gateway.py", line 205,
> in handler\n module = __import__(modname, globals(), locals(),
> [''])
> ImportError: No module named codep
>
> Anyone have an idea of what I'm doing wrong (apart from running
> Windows)? Thanks,
>
> Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---