PageRenderTime 243ms CodeModel.GetById 140ms app.highlight 2ms RepoModel.GetById 99ms app.codeStats 0ms

Mako | 108 lines | 84 code | 24 blank | 0 comment | 3 complexity | 8f98d5a972d50a9197fd06c318d91250 MD5 | raw file
  1<div class="yui-b content">
  2    <h1>Features</h1>
  4    <h2>Comfortable Interactive Debugger</h2>
  6    <p>Programming means making mistakes. And searching for the cause of an error
  7    distracts you from the task at hand and is annoying. Especially in web
  8    applications you usually do not have a fancy debugger at hand that allows you
  9    to view all variables and the piece of code where the error occurred.</p>
 11    <p>Pylons
 12    offers a great online debugger. If your application throws an exception you
 13    will get a traceback on the web page, can view local variables and can even
 14    enter Python statements interactively. Sometimes people even deliberately throw
 15    in a ``raise Exception`` statement to make the application stop at that line so
 16    they can investigate what is going on.</p>
 18    <p>The debugger even works with AJAX
 19    requests as it prints the debug URL on the console for a sub-request that you
 20    can just paste in your browser and debug it. And in case your application
 21    runs on a production server and get into an error situation it will collect
 22    all that information and send your an email.</p>
 24    <h2>Exploring the world: Paster shell</h2>
 26    <p>A Pylons application uses many different Python modules. The environment
 27    in which your application is running seems pretty opaque. Fortunately you can
 28    run the ``paster shell`` which is a normal Python shell (or even an *ipython*
 29    shell if you have it installed) but has access to all the global variables and
 30    utility functions that Pylons offers.</p>
 32    <p>Play with your database models, explore
 33    the "Webhelpers" utilities, browse through the available global variables and
 34    even simulate requests as if you used a browser. And if things work as you
 35    expect you just copy the code into your application.</p>
 37    <h2>Web server built in</h2>
 39    <p>Pylons uses *Paste* for setting up a project, upgrading it to a newer Pylons
 40    version and deploying the application. And it even features a built-in web
 41    server that you can use to develop and test your applications. You don't have to
 42    install an additional web server like Apache to run your application.
 43    Development happens directly on your workstation. And the Paste web server is
 44    even powerful enough that some people use in on production servers.</p>
 46    <h2>Simplifying the development cycle: --reload</h2>
 48    <p>Developing under a web framework means that your framework has to be restarted
 49    once you changed something. If you use the Paste web server you can toss in the
 50    ``--reload`` option so that Paste will monitor your files. Once you save a
 51    changed file it will automatically detect that and reload the framework. Your
 52    development cycle is essentially saving the file and reloading the page in the
 53    browser. It could not be simpler.</p>
 55    <h2>WSGI - ready for production use</h2>
 57    <p>Pylons does not depend on a certain web server. Other frameworks may have a web
 58    server built in - so you depend on its stability, security and features. Pylons
 59    is a WSGI framework which means that it works on any web server that speaks
 60    WSGI. WSGI is a protocol between web servers and web applications - similar to
 61    CGI. Basically any WSGI web application can run with any WSGI web server. And
 62    you can even use WSGI *middleware* which is code you can simply plug between the
 63    web server and the web application to provide features like authentication or
 64    logging.</p>
 66    <h2>Smooth upgrades</h2>
 68    <p>Pylons is a template for your project. It creates a number of files and
 69    directories where your HTML templates, database models and controller code goes
 70    into. You will surely change that template a lot. But what happens when a new
 71    version of Pylons is released? No problem. Pylons can show you the differences
 72    between your files and the new template and you are free to adopt any changes.
 73    So you are always up-to-date without starting from scratch.</p>
 75    <h2>The web developer's toolbox: Webhelpers</h2>
 77    <p>To avoid reinventing the wheel Pylons applications can use the *Webhelpers*
 78    package. It contains functions to deal with HTML tags and HTML forms, they convert
 79    numbers into human-readable forms, deal with RSS feeds and split large outputs
 80    (like database tables) into pages by only a few lines of Python code.</p>
 82    <h2>Beautiful URLs</h2>
 84    <p>Usually you don't have complete control over the URL in web applications. They
 85    look like ``/cgi-bin/`` or
 86    ``/customers/settings.php?customerid=123``. Pylons instead uses *Routes*
 87    to map any URL scheme to different parts of your application. So you will
 88    rather end up with user-friendly and memorable URLs like ``/articles/2008``
 89    or ``/products/computer/keyboards``.</p>
 91    <h2>Exchangeable components</h2>
 93    <p>Pylons is open-minded. You can use it with different templating languages and
 94    different database toolkits. A good selection of components is already
 95    configured so that you can get started quickly. But it is really easy to replace
 96    them if they do not match your taste.</p>
 98    <h2>Separated models, views and controllers</h2>
100    <p>In Pylons you separate the models (your database schema), the views (HTML
101    templates) and the controllers (your application code). That is called *MVC*
102    (model, view, controller). Using this MVC approach you can change database
103    models or the HTML templates without risking to break your application code.</p>
106<%def name="title()">${parent.title()} - ${_('Features')}</%def>
107<%inherit file="/layout.mako" />
108<%namespace name="widgets" file="/widgets.mako"/>