File: test_noserver.py

package info (click to toggle)
python-cherrypy 2.2.1-3
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 796 kB
  • ctags: 1,079
  • sloc: python: 7,869; makefile: 15
file content (31 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Test WSGI servers and gateways, such as mod_python.

mod_python
----------

Put the following four lines somewhere in your Apache2 .conf:

PythonImport cherrypy.test.test_noserver REDROVER.HQAMOR.amorhq.net
SetHandler python-program
PythonHandler wsgiref.modpython_gateway::handler
PythonOption application cherrypy._cpwsgi::wsgiApp

"""
import test
test.prefer_parent_path()

import cherrypy
from cherrypy import _cpwsgi

class HelloWorld:
    def index(self):
        return "Hello world!"
    index.exposed = True
    wsgi_asp = index

cherrypy.root = HelloWorld()
cherrypy.root.test = HelloWorld()

cherrypy.config.update({"server.environment": "production"})
cherrypy.server.start(server_class = None)