Custom Search
Showing posts with label Pylons. Show all posts
Showing posts with label Pylons. Show all posts

Thursday, January 3, 2013

Introduction pyramid __init__.py and views.py

Introduction to the pyramid __init__.py and views.py

a)   

An __init__.py file signifies that this is a Python package. It also contains code that helps users run the application, including a main function which is used as a entry point for commands such as pserve, pshell, pviews, and others.

b)   
A templates directory, which contains Chameleon (or other types of) templates.

c)   
A tests.py module, which contains unit test code for the application.

d)   
A views.py module, which contains view code for the application.

a)
__init__.py
========

We need a small Python module that configures our application and which advertises an entry point for use by our PasteDeploy .ini file. This is the file named __init__.py. The presence of an __init__.py also informs Python that the directory which contains it is a package.

from pyramid.config import Configurator
from sqlalchemy import engine_from_config

from .models import (
    DBSession,
    Base,
    )


def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    print "===__init_.py===main===global_config===", global_config
    print "===__init_.py===main===settings===", settings
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    config = Configurator(settings=settings)
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('home', '/')
    config.scan()
    return config.make_wsgi_app()

-----------------------

===__init_.py===main===global_config===
{'__file__': '/home/saju/pyra_env/test/alchemy_proj/development.ini',
'here': '/home/saju/pyra_env/test/alchemy_proj'}

===__init_.py===main===settings===
{'pyramid.includes': '\npyramid_debugtoolbar\npyramid_tm',
'sqlalchemy.url': 'mysql://root:xxxx@localhost:3306/mydb1?charset=utf8',
'pyramid.debug_authorization': 'false',
'pyramid.default_locale_name': 'en',
'pyramid.reload_templates': 'true',
'pyramid.debug_notfound': 'false',
'pyramid.debug_routematch': 'false'}

b)
views.py
=======

Much of the heavy lifting in a Pyramid application is done by view callables. A view callable is the main tool of a Pyramid web application developer; it is a bit of code which accepts a request and which returns a response.

from pyramid.view import view_config

@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
    return {'project':'MyProject'}

Above code define and register a view callable named my_view. The function named my_view is decorated with a view_config decorator (which is processed by the config.scan() line in our __init__.py). The view_config decorator asserts that this view be found when a route named home is matched. In our case, because our __init__.py maps the route named home to the URL pattern /, this route will match when a visitor visits the root URL. The view_config decorator also names a renderer, which in this case is a template that will be used to render the result of the view callable.

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/project.html

Introduction pyramid development.ini production.ini MANIFEST.in and setup.py

Introduction to the pyramid development.ini production.ini MANIFEST.in and setup.py

1)
development.ini
============

a)
The development.ini file is a PasteDeploy configuration file. Its purpose is to specify an application to run when you invoke pserve, as well as the deployment settings provided to that application.

b)
The [app:main] section represents configuration for your Pyramid application. The use setting is the only setting required to be present in the [app:main] section. Its default value, egg:MyProject, indicates that our MyProject project contains the application that should be served. Other settings added to this section are passed as keyword arguments to the function named main in our package’s __init__.py module. You can provide startup-time configuration parameters to your application by adding more settings to this section.

c)

The name main in [app:main] signifies that this is the default application run by pserve when it is invoked against this configuration file. The name main is a convention used by PasteDeploy signifying that it is the default application.

d)
The [server:main] section of the configuration file configures a WSGI server which listens on TCP port 6543. It is configured to listen on all interfaces (0.0.0.0). This means that any remote system which has TCP access to your system can see your Pyramid application.

2)
production.ini
===========

The production.ini file is a PasteDeploy configuration file with a purpose much like that of development.ini. However, it disables the debug toolbar, and filters all log messages except those above the WARN level. It also turns off template development options such that templates are not automatically reloaded when changed, and turns off all debugging options. This file is appropriate to use instead of development.ini when you put your application into production.

It’s important to use production.ini (and not development.ini) to benchmark your application and put it into production. development.ini configures your system with a debug toolbar that helps development, but the inclusion of this toolbar slows down page rendering times by over an order of magnitude. The debug toolbar is also a potential security risk if you have it configured incorrectly.

3)
MANIFEST.in
==========
a)

The MANIFEST.in file is a distutils configuration file which specifies the non-Python files that should be included when a distribution of your Pyramid project is created when you run python setup.py sdist. Due to the information contained in the default MANIFEST.in, an sdist of your Pyramid project will include .txt files, .ini files, .rst files, graphics files, and template files, as well as .py files.

4)
setup.py
=======

a)
The setup.py file is a setuptools setup file. It is meant to be run directly from the command line to perform a variety of functions, such as testing your application, packaging, and distributing your application.
The setup.py file calls the setuptools setup function, which does various things depending on the arguments passed to setup.py on the command line.

b)

Usually you only need to think about the contents of the setup.py file when distributing your application to other people, when adding Python package dependencies, or when versioning your application for your own use. For fun, you can try this command now:

$ python setup.py sdist

This will create a tarball of your application in a dist subdirectory named MyProject-0.1.tar.gz. You can send this tarball to other people who want to install and use your application.

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/project.html

Wednesday, January 2, 2013

How to create and run a pyramid alchemy project

How to create and run a pyramid alchemy project
===================================

(pyra_env)saju@saju-desktop:~/pyra_env/test$ pcreate -s alchemy alchemy_proj
Creating directory /home/saju/pyra_env/test/alchemy_proj
  Recursing into +package+
    Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/
    Copying __init__.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/__init__.py
    Copying models.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/models.py
    Recursing into scripts
      Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/scripts/
      Copying __init__.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/scripts/__init__.py
      Copying initializedb.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/scripts/initializedb.py
    Recursing into static
      Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/
      Copying favicon.ico to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/favicon.ico
      Copying footerbg.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/footerbg.png
      Copying headerbg.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/headerbg.png
      Copying ie6.css to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/ie6.css
      Copying middlebg.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/middlebg.png
      Copying pylons.css to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/pylons.css
      Copying pyramid-small.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/pyramid-small.png
      Copying pyramid.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/pyramid.png
      Copying transparent.gif to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/transparent.gif
    Recursing into templates
      Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/templates/
      Copying mytemplate.pt_tmpl to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/templates/mytemplate.pt
    Copying tests.py_tmpl to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/tests.py
    Copying views.py_tmpl to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/views.py
  Copying CHANGES.txt_tmpl to /home/saju/pyra_env/test/alchemy_proj/CHANGES.txt
  Copying MANIFEST.in_tmpl to /home/saju/pyra_env/test/alchemy_proj/MANIFEST.in
  Copying README.txt_tmpl to /home/saju/pyra_env/test/alchemy_proj/README.txt
  Copying development.ini_tmpl to /home/saju/pyra_env/test/alchemy_proj/development.ini
  Copying production.ini_tmpl to /home/saju/pyra_env/test/alchemy_proj/production.ini
  Copying setup.cfg_tmpl to /home/saju/pyra_env/test/alchemy_proj/setup.cfg
  Copying setup.py_tmpl to /home/saju/pyra_env/test/alchemy_proj/setup.py
Welcome to Pyramid.  Sorry for the convenience.
(pyra_env)saju@saju-desktop:~/pyra_env/test$


* The setup.py file in that directory can be used to distribute your application,
or install your application for deployment or development.

* To install a newly created project for development, you should cd to the newly
created project directory and run the command "#python setup.py develop".

* The file named setup.py will be in the root of the pcreate-generated project directory.

* The command "#python setup.py develop" will install a distribution representing your
project into the interpreter’s library set so it can be found by import statements and
by other console scripts such as pserve, pshell, proutes and pviews.


python setup.py develop
==================

(pyra_env)saju@saju-desktop:~/pyra_env/test/alchemy_proj$ python setup.py develop
running develop
running egg_info
creating alchemy_proj.egg-info
writing requirements to alchemy_proj.egg-info/requires.txt
writing alchemy_proj.egg-info/PKG-INFO
writing top-level names to alchemy_proj.egg-info/top_level.txt
writing dependency_links to alchemy_proj.egg-info/dependency_links.txt
...................
........this will install all dependencies...........
...................


Initialize Database
==============

a)
Open development.ini and add following line
sqlalchemy.url=mysql://root:paswword@localhost:3306/mydb1?charset=utf8

b)
Open models.py and replace "name = Column(Text, unique=True)" with "name = Column(String(255), unique=True)"

c)
(pyra_env)saju@saju-desktop:~/pyra_env/test/alchemy_proj$ initialize_alchemy_proj_db development.ini
2013-01-02 19:56:02,084 INFO  [sqlalchemy.engine.base.Engine][MainThread] SELECT DATABASE()
2013-01-02 19:56:02,085 INFO  [sqlalchemy.engine.base.Engine][MainThread] ()
2013-01-02 19:56:02,086 INFO  [sqlalchemy.engine.base.Engine][MainThread] SHOW VARIABLES LIKE 'character_set%%'
2013-01-02 19:56:02,086 INFO  [sqlalchemy.engine.base.Engine][MainThread] ()
2013-01-02 19:56:02,087 INFO  [sqlalchemy.engine.base.Engine][MainThread] SHOW VARIABLES LIKE 'sql_mode'
2013-01-02 19:56:02,087 INFO  [sqlalchemy.engine.base.Engine][MainThread] ()
2013-01-02 19:56:02,087 INFO  [sqlalchemy.engine.base.Engine][MainThread] DESCRIBE `models`
2013-01-02 19:56:02,088 INFO  [sqlalchemy.engine.base.Engine][MainThread] ()
2013-01-02 19:56:02,088 INFO  [sqlalchemy.engine.base.Engine][MainThread] ROLLBACK
2013-01-02 19:56:02,088 INFO  [sqlalchemy.engine.base.Engine][MainThread]
CREATE TABLE models (
    id INTEGER NOT NULL AUTO_INCREMENT,
    name VARCHAR(255),
    value INTEGER,
    PRIMARY KEY (id),
    UNIQUE (name)
)


2013-01-02 19:56:02,089 INFO  [sqlalchemy.engine.base.Engine][MainThread] ()
2013-01-02 19:56:02,183 INFO  [sqlalchemy.engine.base.Engine][MainThread] COMMIT
2013-01-02 19:56:02,184 INFO  [sqlalchemy.engine.base.Engine][MainThread] BEGIN (implicit)
2013-01-02 19:56:02,184 INFO  [sqlalchemy.engine.base.Engine][MainThread] INSERT INTO models (name, value) VALUES (%s, %s)
2013-01-02 19:56:02,185 INFO  [sqlalchemy.engine.base.Engine][MainThread] ('one', 1)
2013-01-02 19:56:02,185 INFO  [sqlalchemy.engine.base.Engine][MainThread] COMMIT
(pyra_env)saju@saju-desktop:~/pyra_env/test/alchemy_proj$


Running the Application
==================

(pyra_env)saju@saju-desktop:~/pyra_env/test/alchemy_proj$ pserve development.ini --reload
Starting subprocess with file monitor
===in  add_route=== home /
===in add_view=== function my_view at 0x3c81aa0> home
Starting server in PID 27614.
serving on http://0.0.0.0:6543

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/project.html

how to create and run a pyramid project

1) How to create starter project
======================

(pyra_env)saju@saju-desktop:~/pyra_env/test$ pcreate -s starter starter_proj
Creating directory /home/saju/pyra_env/test/starter_proj
  Recursing into +package+
    Creating /home/saju/pyra_env/test/starter_proj/starter_proj/
    Copying __init__.py to /home/saju/pyra_env/test/starter_proj/starter_proj/__init__.py
    Recursing into static
      Creating /home/saju/pyra_env/test/starter_proj/starter_proj/static/
      Copying favicon.ico to /home/saju/pyra_env/test/starter_proj/starter_proj/static/favicon.ico
      Copying footerbg.png to /home/saju/pyra_env/test/starter_proj/starter_proj/static/footerbg.png
      Copying headerbg.png to /home/saju/pyra_env/test/starter_proj/starter_proj/static/headerbg.png
      Copying ie6.css to /home/saju/pyra_env/test/starter_proj/starter_proj/static/ie6.css
      Copying middlebg.png to /home/saju/pyra_env/test/starter_proj/starter_proj/static/middlebg.png
      Copying pylons.css to /home/saju/pyra_env/test/starter_proj/starter_proj/static/pylons.css
      Copying pyramid-small.png to /home/saju/pyra_env/test/starter_proj/starter_proj/static/pyramid-small.png
      Copying pyramid.png to /home/saju/pyra_env/test/starter_proj/starter_proj/static/pyramid.png
      Copying transparent.gif to /home/saju/pyra_env/test/starter_proj/starter_proj/static/transparent.gif
    Recursing into templates
      Creating /home/saju/pyra_env/test/starter_proj/starter_proj/templates/
      Copying mytemplate.pt_tmpl to /home/saju/pyra_env/test/starter_proj/starter_proj/templates/mytemplate.pt
    Copying tests.py_tmpl to /home/saju/pyra_env/test/starter_proj/starter_proj/tests.py
    Copying views.py_tmpl to /home/saju/pyra_env/test/starter_proj/starter_proj/views.py
  Copying CHANGES.txt_tmpl to /home/saju/pyra_env/test/starter_proj/CHANGES.txt
  Copying MANIFEST.in_tmpl to /home/saju/pyra_env/test/starter_proj/MANIFEST.in
  Copying README.txt_tmpl to /home/saju/pyra_env/test/starter_proj/README.txt
  Copying development.ini_tmpl to /home/saju/pyra_env/test/starter_proj/development.ini
  Copying production.ini_tmpl to /home/saju/pyra_env/test/starter_proj/production.ini
  Copying setup.cfg_tmpl to /home/saju/pyra_env/test/starter_proj/setup.cfg
  Copying setup.py_tmpl to /home/saju/pyra_env/test/starter_proj/setup.py
Welcome to Pyramid.  Sorry for the convenience.
(pyra_env)saju@saju-desktop:~/pyra_env/test$


2) How to create alchemy project
=======================

(pyra_env)saju@saju-desktop:~/pyra_env/test$ pcreate -s alchemy alchemy_proj
Creating directory /home/saju/pyra_env/test/alchemy_proj
  Recursing into +package+
    Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/
    Copying __init__.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/__init__.py
    Copying models.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/models.py
    Recursing into scripts
      Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/scripts/
      Copying __init__.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/scripts/__init__.py
      Copying initializedb.py to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/scripts/initializedb.py
    Recursing into static
      Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/
      Copying favicon.ico to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/favicon.ico
      Copying footerbg.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/footerbg.png
      Copying headerbg.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/headerbg.png
      Copying ie6.css to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/ie6.css
      Copying middlebg.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/middlebg.png
      Copying pylons.css to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/pylons.css
      Copying pyramid-small.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/pyramid-small.png
      Copying pyramid.png to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/pyramid.png
      Copying transparent.gif to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/static/transparent.gif
    Recursing into templates
      Creating /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/templates/
      Copying mytemplate.pt_tmpl to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/templates/mytemplate.pt
    Copying tests.py_tmpl to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/tests.py
    Copying views.py_tmpl to /home/saju/pyra_env/test/alchemy_proj/alchemy_proj/views.py
  Copying CHANGES.txt_tmpl to /home/saju/pyra_env/test/alchemy_proj/CHANGES.txt
  Copying MANIFEST.in_tmpl to /home/saju/pyra_env/test/alchemy_proj/MANIFEST.in
  Copying README.txt_tmpl to /home/saju/pyra_env/test/alchemy_proj/README.txt
  Copying development.ini_tmpl to /home/saju/pyra_env/test/alchemy_proj/development.ini
  Copying production.ini_tmpl to /home/saju/pyra_env/test/alchemy_proj/production.ini
  Copying setup.cfg_tmpl to /home/saju/pyra_env/test/alchemy_proj/setup.cfg
  Copying setup.py_tmpl to /home/saju/pyra_env/test/alchemy_proj/setup.py
Welcome to Pyramid.  Sorry for the convenience.
(pyra_env)saju@saju-desktop:~/pyra_env/test$

====================

* The setup.py file in that directory can be used to distribute your application,
or install your application for deployment or development.

* To install a newly created project for development, you should cd to the newly
created project directory and run the command "#python setup.py develop".

* The file named setup.py will be in the root of the pcreate-generated project directory.

* The command "#python setup.py develop" will install a distribution representing your
project into the interpreter’s library set so it can be found by import statements and
by other console scripts such as pserve, pshell, proutes and pviews.


python setup.py develop
==================
(pyra_env)saju@saju-desktop:~/pyra_env/test/alchemy_proj$ python setup.py develop
running develop
running egg_info
creating alchemy_proj.egg-info
writing requirements to alchemy_proj.egg-info/requires.txt
writing alchemy_proj.egg-info/PKG-INFO
writing top-level names to alchemy_proj.egg-info/top_level.txt
writing dependency_links to alchemy_proj.egg-info/dependency_links.txt
...................
........this will install all dependencies...........
...................

Running the project application
========================
* Once a project is installed for development, you can run the application it represents
using the pserve command against the generated configuration file. In our case,
this file is named development.ini.

$pserve development.ini
Starting server in PID 16601.
serving on 0.0.0.0:6543 view at http://127.0.0.1:6543

OR

$pserve development.ini --reload
Starting subprocess with file monitor
Starting server in PID 16601.
serving on http://0.0.0.0:6543


* You can change the port on which the server runs on by changing the development.ini file.
For example, you can change the port = 6543 line in the development.ini file’s [server:main]
section to port = 8080 to run the server on port 8080 instead of port 6543.


The Startup Process (IMP)
====================
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/startup.html

=============

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/project.html

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/startup.html

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/logging.html

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/environment.html

How to explain Your First Pyramid Application

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

def hello_world(request):
    return Response('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()
    server = make_server('0.0.0.0', 8080, app)
    server.serve_forever()



########################################


from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

"""
* http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/firstapp.html
* The script imports the Configurator class from the pyramid.config module. An instance of the Configurator class is later used to configure your Pyramid application.
* Like many other Python web frameworks, Pyramid uses the WSGI protocol to connect an application and a web server together.

"""

def hello_world(request):
    """
    * The function accepts a single argument (request) and it returns an instance of the pyramid.response.Response class.
    * This function is known as a view callable. A view callable accepts a single argument, request.
      It is expected to return a response object.
      A view callable doesn’t need to be a function; it can be represented via another type of object, like a class or an instance.
        * A view callable is always called with a request object.
        * A view callable is required to return a response object because a response object has
      all the information necessary to formulate an actual HTTP response; this object is
          then converted to text by the WSGI server which called Pyramid and it is sent back to the requesting browser.
    """  
    print "======request.matchdict========", request.matchdict ,"\n"
    return Response('Hello %(name)s!' % request.matchdict)

if __name__ == '__main__':
    """
       * Application Configuration
       * Methods called on the Configurator will cause registrations to be made in an
     application registry associated with the application.An application registry maps resource types to views,
     as well as housing other application-specific component registrations.
         Every Pyramid application has one (and only one) application registry.
       * In browser, type http://127.0.0.1:8080/hello/saju
         Here string "saju" will map to "name" and
         get in view via dictionary request.matchdict.
         eg:{'name': u'saju'}.
       * A call to make_wsgi_app implies that all configuration is finished (meaning all method calls to
     the configurator which set up views, and various other configuration settings have been performed).
         The make_wsgi_app method returns a WSGI application object that can be used by any WSGI server to
         present an application to a requestor. WSGI is a protocol that allows servers to talk to Python applications.    
    """  
    ###Configurator Construction###
    config = Configurator()
    ###Adding Configuration###
    ##registers a route to match any URL path that begins with /hello/ followed by a string.
    config.add_route('hello', '/hello/{name}')
    ##registers the hello_world function as a view callable and makes sure that it will be called when the hello route is matched.
    config.add_view(hello_world, route_name='hello')
    ##WSGI Application Creation###
    app = config.make_wsgi_app()
    ###WSGI Application Serving###
    server = make_server('0.0.0.0', 8080, app)
    print "===wsgiref Server Running==="
    server.serve_forever()
    print "===wsgiref Server Stopped==="

Creating Your First Pyramid Application example

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response


def hello_world(request):
    print "===request.matchdict===", request.matchdict ,"\n"
    return Response('Hello %(name)s!' % request.matchdict)

if __name__ == '__main__':
    """In browser, type http://127.0.0.1:8080/hello/saju
       Here string "saju" will map to "name" and
       get in view via dictionary request.matchdict.
       eg:{'name': u'saju'}.
    """   
    config = Configurator()
    config.add_route('hello', '/hello/{name}')
    config.add_view(hello_world, route_name='hello')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 8080, app)
    print "===Server Running==="
    server.serve_forever()
    print "===Server Stopped==="


OutPut
#######


In Terminal
*************
saju@saju-desktop:~/pyra_env$ python test.py
===Server Running===
===request.matchdict=== {'name': u'saju'}

In Browser
************

Hello saju!