diff options
| author | Dylan Jay <software@pretaweb.com> | 2011-08-25 13:05:52 +1000 |
|---|---|---|
| committer | Dylan Jay <software@pretaweb.com> | 2011-08-25 13:05:52 +1000 |
| commit | d36b566a83addddb80d221aa042b828268f185f2 (patch) | |
| tree | e2a4b9c2ed570a49971817da29e24fcc1a165235 /docs/narr/helloworld.py | |
| parent | 141f90581ce667ff12db8ef9ccd8a6e59d07ef73 (diff) | |
| download | pyramid-d36b566a83addddb80d221aa042b828268f185f2.tar.gz pyramid-d36b566a83addddb80d221aa042b828268f185f2.tar.bz2 pyramid-d36b566a83addddb80d221aa042b828268f185f2.zip | |
use routes in firstapp as they are more familar to most and put hello world on the front page
to make grab framework shoppers attention.
Diffstat (limited to 'docs/narr/helloworld.py')
| -rw-r--r-- | docs/narr/helloworld.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/narr/helloworld.py b/docs/narr/helloworld.py new file mode 100644 index 000000000..23bb146df --- /dev/null +++ b/docs/narr/helloworld.py @@ -0,0 +1,12 @@ +from paste.httpserver import serve +from pyramid.configuration import Configurator + +def hello_world(request): + return 'Hello %(name)s!' % request.matchdict + +if __name__ == '__main__': + config = Configurator() + config.add_route('hello', '/hello/{name}') + config.add_view(hello_world, route_name='hello') + app = config.make_wsgi_app() + serve(app, host='0.0.0.0')
\ No newline at end of file |
