From d36b566a83addddb80d221aa042b828268f185f2 Mon Sep 17 00:00:00 2001 From: Dylan Jay Date: Thu, 25 Aug 2011 13:05:52 +1000 Subject: 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. --- docs/index.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'docs/index.rst') diff --git a/docs/index.rst b/docs/index.rst index 380dce065..0acf24b5a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,29 @@ development framework. It is developed as part of the `Pylons Project `_. It is licensed under a `BSD-like license `_. +Here is one of the simplest :app:`Pyramid` applications you can make. + +.. code-block:: python + + 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') + +See :ref:`firstapp_chapter` for a full explanation of how this :ref:`helloworld_imperative` +app works. Read the :ref:`narrative_documentation` to understand how :app:`Pyramid` is designed +to scale from these simple beginnings to handle the largest of web application needs. If your +familiar with other web frameworks you might want to look at :ref:`design_defense` to understand +why :app:`Pyramid` has been designed the way it has. + Front Matter ============ @@ -28,6 +51,8 @@ Front Matter whatsnew-1.1 whatsnew-1.0 +.. _narrative_documentation: + Narrative documentation ======================= -- cgit v1.2.3 From a98c0169fad222654e0c2ba0573653002a21d29b Mon Sep 17 00:00:00 2001 From: Dylan Jay Date: Thu, 25 Aug 2011 13:10:43 +1000 Subject: include rather than repeat helloworld.py --- docs/index.rst | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'docs/index.rst') diff --git a/docs/index.rst b/docs/index.rst index 0acf24b5a..70cf4cabf 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,20 +11,7 @@ development framework. It is developed as part of the `Pylons Project Here is one of the simplest :app:`Pyramid` applications you can make. -.. code-block:: python - - 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') +.. literalinclude:: narr/helloworld.py See :ref:`firstapp_chapter` for a full explanation of how this :ref:`helloworld_imperative` app works. Read the :ref:`narrative_documentation` to understand how :app:`Pyramid` is designed -- cgit v1.2.3 From d73be153fa9544f453510524f34d55a7602e0896 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 25 Aug 2011 02:23:51 -0400 Subject: use Response; fix text --- docs/index.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/index.rst') diff --git a/docs/index.rst b/docs/index.rst index 70cf4cabf..3d66be648 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,11 +13,11 @@ Here is one of the simplest :app:`Pyramid` applications you can make. .. literalinclude:: narr/helloworld.py -See :ref:`firstapp_chapter` for a full explanation of how this :ref:`helloworld_imperative` -app works. Read the :ref:`narrative_documentation` to understand how :app:`Pyramid` is designed -to scale from these simple beginnings to handle the largest of web application needs. If your -familiar with other web frameworks you might want to look at :ref:`design_defense` to understand -why :app:`Pyramid` has been designed the way it has. +See :ref:`firstapp_chapter` for a full explanation of how this +:ref:`helloworld_imperative` app works. Read the +:ref:`narrative_documentation` to understand how :app:`Pyramid` is designed +to scale from these simple beginnings to handle the largest of web +application needs. Front Matter ============ -- cgit v1.2.3