|
Revision 1619
(checked in by fumanchu, 2 years ago)
|
Fix for #660 (Add a 'wsgi.errors' logging handler).
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
""" |
|---|
| 2 |
Tutorial - Hello World |
|---|
| 3 |
|
|---|
| 4 |
The most basic (working) CherryPy application possible. |
|---|
| 5 |
""" |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
import cherrypy |
|---|
| 9 |
|
|---|
| 10 |
class HelloWorld: |
|---|
| 11 |
""" Sample request handler class. """ |
|---|
| 12 |
|
|---|
| 13 |
def index(self): |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
return "Hello world!" |
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
index.exposed = True |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
import os.path |
|---|
| 26 |
tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') |
|---|
| 27 |
|
|---|
| 28 |
if __name__ == '__main__': |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
cherrypy.quickstart(HelloWorld(), config=tutconf) |
|---|
| 33 |
else: |
|---|
| 34 |
|
|---|
| 35 |
cherrypy.tree.mount(HelloWorld(), config=tutconf) |
|---|