A problem about pyamf + cherrypy + mod_wsgi in Apache

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

A problem about pyamf + cherrypy + mod_wsgi in Apache

Eric Chen-5
Dears,

I am using cherrypy with mod_wsgi running in Apache now.
When I try tutorials for cherrypy
I add the line "cherrypy.tree.graft(gateway, "/gateway/")"
And use"application = cherrypy.Application(Root(), script_name=None, config=None)" constructed.

When I access / It's work normally.
But when I access /gateway/ , I get 404 Not Found.

What step for me is wrong?
--
Best regards,
Eric Chen

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: A problem about pyamf + cherrypy + mod_wsgi in Apache

Nick Joyce
On 14 Jul 2010, at 14:14, 水鏡 wrote:

> Dears,
>
> I am using cherrypy with mod_wsgi running in Apache now.
> When I try tutorials for cherrypy
> I add the line "cherrypy.tree.graft(gateway, "/gateway/")"
> And use"application = cherrypy.Application(Root(), script_name=None, config=None)" constructed.
>
> When I access / It's work normally.
> But when I access /gateway/ , I get 404 Not Found.
>
> What step for me is wrong?
> --
> Best regards,
> Eric Chen

Hi Eric,

All the steps you have taken appear to be okay. Have you checked the Apache/CherryPy logs to see if they give you any more information?

Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: A problem about pyamf + cherrypy + mod_wsgi in Apache

Eric Chen-5
Dears,

Logfile seems have not any error.

this is my code below.
######.conf#######
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /home/cherry/mod.py
<Directory /home/cherry>
    WSGIApplicationGroup %{GLOBAL}
</Directory>
######mod.py#######
# -*- coding: utf-8 -*-

import cherrypy
import os
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
from pyamf.remoting.gateway.wsgi import WSGIGateway
import logging

logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s'
)


def echo(data):
   """
   This is a function that we will expose.
   """
   return data

services = {
   'myservice.echo': echo,
   # Add other exposed functions here
}

gateway = WSGIGateway(services, logger=logging, debug=True)
class r:
    def index(self):
        return "Hello world!"
    index.exposed = True
class l2:
    def index(self):
        return "LEVEL2"
    index.exposed = True

cherrypy.config.update({'log.error_file': '/tmp/cerr.log',
                       'log.access_file': '/tmp/cacc.log',
                       'log.screen': False,
                        })
if 1:
    cherrypy.tree.graft(gateway, "/gateway/")
    root = r()
    root.l2 = l2()
    import sys
    sys.stdout = sys.stderr

    import atexit
    import threading
    cherrypy.config.update({'environment': 'embedded',
                            })
    if cherrypy.__version__.startswith('3.0') and cherrypy.engine.state == 0:
        cherrypy.engine.start(blocking=False)
        atexit.register(cherrypy.engine.stop)
    application = cherrypy.Application(root, script_name=None, config=None)

2010/7/15 Nick Joyce <[hidden email]>
On 14 Jul 2010, at 14:14, 水鏡 wrote:

> Dears,
>
> I am using cherrypy with mod_wsgi running in Apache now.
> When I try tutorials for cherrypy
> I add the line "cherrypy.tree.graft(gateway, "/gateway/")"
> And use"application = cherrypy.Application(Root(), script_name=None, config=None)" constructed.
>
> When I access / It's work normally.
> But when I access /gateway/ , I get 404 Not Found.
>
> What step for me is wrong?
> --
> Best regards,
> Eric Chen

Hi Eric,

All the steps you have taken appear to be okay. Have you checked the Apache/CherryPy logs to see if they give you any more information?

Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users



--
如果想長久地享受幸福,就要在最短距離抓住幸福才行。
Best regards,
Eric Chen

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: A problem about pyamf + cherrypy + mod_wsgi in Apache

Nick Joyce
On 15 Jul 2010, at 13:25, 水鏡 wrote:

> Dears,
>
> Logfile seems have not any error.
>
> this is my code below.
> ######.conf#######
> LoadModule wsgi_module modules/mod_wsgi.so
> WSGIScriptAlias / /home/cherry/mod.py
> <Directory /home/cherry>
>     WSGIApplicationGroup %{GLOBAL}
> </Directory>
> ######mod.py#######
> # -*- coding: utf-8 -*-
>
> import cherrypy
> import os
> os.environ['PYTHON_EGG_CACHE'] = '/tmp'
> from pyamf.remoting.gateway.wsgi import WSGIGateway
> import logging
>
> logging.basicConfig(
>     level=logging.DEBUG,
>     format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s'
> )
>
>
> def echo(data):
>    """
>    This is a function that we will expose.
>    """
>    return data
>
> services = {
>    'myservice.echo': echo,
>    # Add other exposed functions here
> }
>
> gateway = WSGIGateway(services, logger=logging, debug=True)
> class r:
>     def index(self):
>         return "Hello world!"
>     index.exposed = True
> class l2:
>     def index(self):
>         return "LEVEL2"
>     index.exposed = True
>
> cherrypy.config.update({'log.error_file': '/tmp/cerr.log',
>                        'log.access_file': '/tmp/cacc.log',
>                        'log.screen': False,
>                         })
> if 1:
>     cherrypy.tree.graft(gateway, "/gateway/")
>     root = r()
>     root.l2 = l2()
>     import sys
>     sys.stdout = sys.stderr
>
>     import atexit
>     import threading
>     cherrypy.config.update({'environment': 'embedded',
>                             })
>     if cherrypy.__version__.startswith('3.0') and cherrypy.engine.state == 0:
>         cherrypy.engine.start(blocking=False)
>         atexit.register(cherrypy.engine.stop)
>     application = cherrypy.Application(root, script_name=None, config=None)


Sorry, I don't use CherryPy that often, perhaps you should ask in their users list?

http://groups.google.com/group/cherrypy-users

Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users