<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>André Kolell &#187; Pylons Web Framework</title>
	<atom:link href="http://blog.andrekolell.de/category/web-development/pylons-web-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andrekolell.de</link>
	<description>... and what about Life!?</description>
	<lastBuildDate>Sun, 05 Sep 2010 17:11:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to use Ext JS with Pylons and Mako</title>
		<link>http://blog.andrekolell.de/2009/09/10/how-to-use-ext-js-with-pylons-and-mako/</link>
		<comments>http://blog.andrekolell.de/2009/09/10/how-to-use-ext-js-with-pylons-and-mako/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 04:25:57 +0000</pubDate>
		<dc:creator>Andre Kolell</dc:creator>
				<category><![CDATA[(Web) Development]]></category>
		<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Pylons Web Framework]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.andrekolell.de/?p=1187</guid>
		<description><![CDATA[In this little tutorial I will show you how to use the Python web framework Pylons and the Mako template library with the cross-browser JavaScript framework Ext JS. I will explain how to set up a complex layout (this means an Ext.Viewport) and how to dynamically load its contents and further functionality. First of all, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.andrekolell.de/wp-content/uploads/2009/09/ext_js_ajax.gif"><img class="alignright size-full wp-image-1200" title="ExtJS and AJAX" src="http://blog.andrekolell.de/wp-content/uploads/2009/09/ext_js_ajax.gif" alt="ExtJS and AJAX" width="241" height="159" /></a>In this little tutorial I will show you how to use the <a href="http://pylonshq.com/">Python web framework Pylons</a> and the <a href="http://www.makotemplates.org/">Mako template library</a> with the <a href="http://www.extjs.com/products/extjs/">cross-browser JavaScript framework Ext JS</a>.</p>
<p>I will explain how to set up a <a href="http://www.extjs.com/deploy/dev/examples/layout/complex.html">complex layout</a> (this means an Ext.Viewport) and how to dynamically load its contents and further functionality.</p>
<p>First of all, you need to <a href="http://pylonshq.com/docs/en/0.9.7/gettingstarted">set up Pylons</a> and a create a new project. Let&#8217;s  name it &#8220;PylonsAndExt&#8221;. During setup, mako needs to be selected as our template engine. We do not require SQLAlchemy support&#8230;</p>
<p><span id="more-1187"></span></p>
<blockquote>
<pre>paster create -t pylons PylonsAndExt</pre>
</blockquote>
<p>If you like to, verify that everything&#8217;s working well by serving the application (paster serve development.ini) and visiting http://127.0.0.1:5000.</p>
<p>Now we need a controller. Since this controller should provide us with our main application, we name it &#8220;application&#8221;:</p>
<blockquote>
<pre>paster controller application</pre>
</blockquote>
<p>To map the application controller&#8217;s index() action to the root URL of the project, add a new line to the main route map in <em>config/routing.py</em> just after &#8220;# CUSTOM ROUTES HERE&#8221; and empty the <em>public </em>directory (to avoid serving static files):</p>
<blockquote>
<pre>map.connect('/', controller='application', action='index')</pre>
</blockquote>
<p>Next, we modify the ApplicationController&#8217;s index() method so that it returns a mako template. Putting all our Ext JS code into mako files enables us to better internationalize and localize our JavaScript:</p>
<blockquote>
<pre>def index(self):
   return render('/application.mako')</pre>
</blockquote>
<p>To create an Ext.Viewport, we first need Ext. After <a href="http://www.extjs.com/products/extjs/download.php">downloading</a>, place all (relevant) Ext JS files in <em>public/ext</em>.  Inside <em>application.mako</em>, we can now generate our viewport:</p>
<blockquote>
<pre>&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Getting started with Pylons and Ext JS&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css"
    href="ext/resources/css/ext-all.css"/&gt;
  &lt;script src="ext/adapter/ext/ext-base.js"&gt;&lt;/script&gt;
  &lt;script src="ext/ext-all-debug.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    Ext.onReady(function(){
      new Ext.Viewport({
        layout: 'border',
        items: [
          {region: 'north', height: 50},
          {region: 'west', width: 100},
          {region: 'south', height: 50},
          {region: 'east', width: 100},
          {region: 'center',
           xtype: 'tabpanel',
           items: [{
             title: 'Default Tab',
             html: 'The first tab\'s content.'
           }, {
             title: 'AJAX Tab',
             autoLoad: 'application/ajax'
           }]
        }]
      })
    });
  &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;&lt;/body&gt;
&lt;/html&gt;</pre>
</blockquote>
<p>Since we use AJAX to load the content of the second tab (&#8220;AJAX Tab&#8221;), we need to add the ajax() method we specified above to the ApplicationController:</p>
<blockquote>
<pre>def ajax(self):
   return 'Some AJAX Content'</pre>
</blockquote>
<p>Instead of returning a simple string, we could have used a mako template to return more sophisticated content again. Ok, that&#8217;s all really basic so far. I should continue with some more challenging functionalities within the next days&#8230;</p>
<p><em><strong>Any suggestions?</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrekolell.de/2009/09/10/how-to-use-ext-js-with-pylons-and-mako/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem setting up psycopg2 under Windows</title>
		<link>http://blog.andrekolell.de/2009/09/04/problem-setting-up-psycopg2-under-windows/</link>
		<comments>http://blog.andrekolell.de/2009/09/04/problem-setting-up-psycopg2-under-windows/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 06:53:24 +0000</pubDate>
		<dc:creator>Andre Kolell</dc:creator>
				<category><![CDATA[(Web) Development]]></category>
		<category><![CDATA[Pylons Web Framework]]></category>
		<category><![CDATA[Bugfix]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.andrekolell.de/?p=1170</guid>
		<description><![CDATA[When I set up Pylons today in a virtual isolated Python environment on my Windows machine, I had a little fight with psycopg2 (which usually allows me to connect to my PostgreSQL database). At first, everytime I tried to &#8220;easy_install psycopg2&#8243;, I ended up with the error message &#8220;unable to find vcvarsall.bat&#8221;. Luckily I found [...]]]></description>
			<content:encoded><![CDATA[<p>When I set up <a href="http://pylonshq.com/">Pylons</a> today in a virtual isolated Python environment on my Windows machine, I had a little fight with <strong>psycopg2</strong> (which usually allows me to connect to my PostgreSQL database). At first, everytime I tried to &#8220;easy_install psycopg2&#8243;, I ended up with the error message &#8220;unable to find vcvarsall.bat&#8221;.</p>
<p>Luckily I found a solution to get the  &#8220;<a href="http://thomas.broxrost.com/2009/06/01/how-to-compile-simpleparse-210a1-for-python-26-on-windows-vista/">unable to find vcvarsall.bat</a>&#8221; problem fixed.</p>
<p>But unfortunately there was another error when I wanted paster to serve:</p>
<blockquote><p>File &#8220;C:\Python26\lib\site-packages\psycopg2\__init__.py&#8221;,<br />
line 60, in &lt;module&gt;<br />
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID<br />
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.</p></blockquote>
<p>Of course, reinstallation did not fix the problem. I thought the whole challenge might be caused by my virtual environment, because Jason Erickson (who publishes the psycopg Windows binaries) mentioned problems that would occur <a href="http://www.stickpeople.com/projects/python/win-psycopg/">when using psycopg with virtual environments</a> in his blog. But nothing I tried improved my situation.</p>
<p><strong>Solution: Use an older version (2.0.10) of psycopg2!</strong></p>
<p>Later on I found a post in Google Groups, where someone had a <a href="http://groups.google.com/group/django-users/browse_thread/thread/e1b628f0f75896f0?pli=1">similar problem with psycopg2 under Windows</a>. He figured out that there was something wrong with the build of psycopg2 (version 2.0.12) and that simply using an older version (for example 2.0.10) worked fine&#8230; That made my day!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrekolell.de/2009/09/04/problem-setting-up-psycopg2-under-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Pylons Web Framework</title>
		<link>http://blog.andrekolell.de/2009/04/26/the-pylons-web-framework/</link>
		<comments>http://blog.andrekolell.de/2009/04/26/the-pylons-web-framework/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 08:16:40 +0000</pubDate>
		<dc:creator>Andre Kolell</dc:creator>
				<category><![CDATA[(Web) Development]]></category>
		<category><![CDATA[Pylons Web Framework]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[University of Western Sydney]]></category>

		<guid isPermaLink="false">http://blog.andrekolell.de/?p=622</guid>
		<description><![CDATA[As described in one of my previous blog posts, I’ve got the chance to introduce Pylons to my web engineering class as part of my studies at the University of Western Sydney. Thus this blog post gives an overview of the Pylons web framework. Pylons is an open source web framework written in Python. It [...]]]></description>
			<content:encoded><![CDATA[<p><em>As described in one of my </em><a href="http://blog.andrekolell.de/2009/04/09/introduction-in-pylons-in-web-engineering-class/"><em>previous blog posts</em></a><em>, I’ve got the chance to introduce Pylons to my web engineering class as part of my studies at the University of Western Sydney. Thus this blog post gives an overview of the Pylons web framework.</em></p>
<p>Pylons is an open source web framework written in Python. It uses the model view controller architecture, follows the approach of convention over configuration and puts emphasis on loose coupling and clean separation. This helps developers to quickly create sophisticated web applications without hiding what is really going on.<sup>1</sup> In the following paper I will describe the way web applications have been developed in the past and what changes modern web frameworks have led to, especially Pylons.</p>
<p><span id="more-622"></span></p>
<h3>Developing Web Applications the Old Way</h3>
<p>In the past web applications were written as a series of simple CGI scripts. Although these scripts are easy to understand and give developers a lot of power, these scripts have many disadvantages. Some of them are redundant code, no separation of logic and design, a difficult to understand application structure, suboptimal data structures and database access, unreadable URLs and possibly a bad performance since interpreters and modules used by the scripts need to be loaded into memory on each request.<sup>2</sup></p>
<h3>Web Application Development with Pylons</h3>
<p>Modern web frameworks have improved web application development and maintainability by addressing each of the issues described above. Taking a closer look into Pylons internal architecture helps to understand how things have changed.</p>
<p>Compared to other web frameworks such as Django or Ruby on Rails Pylons&#8217; core is remarkably slim and clear, reflecting its focus on loose coupling and clean separation. Instead of using lots of &#8220;glue code&#8221;, Pylons uses low-level APIs that allow quickly and easy assembling of the desired components. Since Pylons also follows the approach of convention over configuration, a Pylons web application can be easily setup by using some of its carefully chosen default components. These include an http server, session management, template engines, URL rewriting, interactive debugging and so forth.</p>
<p>After a Pylons web application has been built, it is deployed on a server. This can be a Paste HTTP server that comes with Pylons, but other HTTP servers such as Apache work as well. Instead of being initialized on each request again, a Pylons web application is set up only once and held in memory by the server (as a Python object), which makes Pylons very fast.<sup>3</sup></p>
<p>Internally Pylons uses the model view controller architecture, leading to a clear separation of the storage and retrieval of data (model), the business logic (controller) and the information representation (view). This separation not only improves the application&#8217;s maintainability and expandability, it also helps to increase security and facilitate the development process as a whole (e. g. programmers and designers can work on the application independently).</p>
<p>Every HTTP request is processed by the Pylons application object in the HTTP server&#8217;s memory (Fig. 1). Before a controller handles a request, it has to pass Pylons completely customizable middleware. At first the <em>Cascade</em> uses the <em>StaticURLParser</em> to see whether the URL requested matches a (static) file in the project&#8217;s public directory. If no file is found &#8220;404 Not Found&#8221; is returned to the <em>Cascade</em> and from there forwarded to the <em>RegistryManager</em>. Since there is only one central application object, a function is needed that separates the different simultaneous threads, each with duration form the incoming request to the outgoing response, from each other. For this purpose the <em>RegistryManager</em> is set up. It keeps every thread in its scope and provides variables that seem to be global but are in fact limited to their thread. After that the request goes to the <em>StatusCodeRedirect</em> and the <em>ErrorHandler</em>, neither do anything relevant just yet, because they are only needed when it comes to the response after a controller action is called. As the names of the following <em>CacheMiddleware</em> and <em>SessionMiddleware</em> already suggest, they add further information to the thread-variables initialized by the <em>RegistryManager</em>, which automatically offer cache and session functionality in Pylons and its controllers. The last step in Pylons original middleware chain is the <em>RoutesMiddleware</em>, which is an improved version of Ruby on Rails routing system.<sup>4</sup> The <em>RoutesMiddleware</em> compares the requested URL to a route map and extracts the routing results to the variables that have been initialized by the <em>RegistryManager</em>. After a request passed all these middleware components, Pylons uses the now available information to delegate the request to the controller action identified by the <em>RoutesMiddleware</em>.<sup>5</sup></p>
<p align="center"><img class="aligncenter size-full wp-image-624" title="Pylons Middleware Architecture and HTTP Request Handling" src="http://blog.andrekolell.de/wp-content/uploads/2009/04/pylons_architecture.png" alt="Pylons Middleware Architecture and HTTP Request Handling" width="471" height="302" /></p>
<p align="center"><strong>Fig. 1: The Pylons Middleware Architecture and HTTP Communication Handling</strong></p>
<p>As shown so far, the default setup of Pylons already solves many of the issues of the early web&#8217;s CGI script applications. Pylons has a straightforward architecture that clearly separates logic and design, comes with caching and session functionality, uses easily readable URLs and offers the possibility to customize everything as needed.</p>
<p>But there&#8217;s a lot more Pylons can do to facilitate web application development. On the model layer Pylons offers many different ways to store data, e. g. in files in the file system, via web services, in object and XML databases and in relational database management systems (RDBMS).<sup>6</sup> When choosing to use a RDBMS such as PostgreSQL or MySQL, object-relational mappers such as the famous SQLAlchemy can be used to map the database&#8217;s data structures to objects in the Pylons application. As soon as objects in the application are changed, object-relational mappers automatically manipulate the underlying data.<sup>7</sup></p>
<p>For authentication and authorization several third-party packages are available. AuthKit as well as repoze.who and repoze.what are some popular examples.<sup>8</sup> These packages are implemented as middleware components and authentication and authorization checks can be easily added to controller actions by using decorators and predicates respectively, i. e. every method knows what (right/role) is required to perform it.</p>
<p>One of the most common responses of web applications is to return a HTML document. Templating systems such as Mako, Genshi or Jinja can be added to a Pylons application to support creating dynamic HTML documents. As always, controller actions pass the data that is necessary for the view to a chosen template. The template then uses this data and let it become part of a good looking design.<sup>9</sup></p>
<p>There is still more Pylons has to offer: Besides a rapidly growing community and an increasing number of references there are internationalization tools, testing tools and logging facilities inside Pylons. Unicode support and systems for easily deployment in different environments are also included. Because Pylons is open source and has exceptionally open low-level APIs, missing functionality can be developed and added easily without changing Pylons core.</p>
<h3>Conclusion</h3>
<p>The architecture of modern web applications has dramatically changed since simple separate CGI scripts haven been used. Although modern web frameworks &#8211; and Pylons as one of them &#8211; may appear to be nontransparent and hard to understand at the beginning, they can, as soon as their general functionality and behavior is understood, facilitate the web application development process enormously. Caching, session management, authentication and authorization, URL mapping, database layer, object mapping and user interface generation are only some issues web frameworks can take care of.</p>
<h3>References</h3>
<p align="left">Agendaless Consulting. 2009a. <em>repoze.who &#8211; WSGI Authentication Middleware.<br />
   </em>[WWW] <a href="http://static.repoze.org/whodocs/">http://static.repoze.org/whodocs/</a>. (April 2009).</p>
<p align="left">Agendaless Consulting. 2009b. <em>repoze.what &#8211; Authorization for WSGI applications.<br />
</em>   [WWW] <a href="http://static.repoze.org/whatdocs/">http://static.repoze.org/whatdocs/</a>. (April 2009).</p>
<p align="left">Bel-EPA. 2009. <em>AuthKit.<br />
   </em>[WWW] <a href="http://bel-epa.com/docs/authkit/">http://bel-epa.com/docs/authkit/</a>. (April 2009).</p>
<p align="left">Gardner, J. 2009. <em>The Definitive Guide to Pylons. </em>Berkeley, CA: Apress.</p>
<p align="left">V. Jayaram. 2007. <em>cgi Scripting Language.<br />
   </em>[WWW] <a href="http://www.hinduwebsite.com/webresources/cgiscripts.asp">http://www.hinduwebsite.com/webresources/cgiscripts.asp</a>. (2009).</p>
<h3>Footnotes </h3>
<p style="text-align: left;"><sup>1 </sup>Gardner, 2009, p. 3-5.<br />
<sup>2 </sup>Some advantages and disadvantages can be found in V. Jayaram, 2007.<br />
<sup>3 </sup>Gardner, 2009, p. 404-405.<br />
<sup>4 </sup>Gardner, 2009, p. 195.<br />
<sup>5 </sup>See Gardner, 2009, p. 408-411 for a detailed Pylons middleware explanation.<br />
<sup>6 </sup>Gardner, 2009, p. 127.<br />
<sup>7 </sup>Of course a lot of configuration is possible to keep the performance on a good level.<br />
<sup>8 </sup>See Bel-EPA, 2009 for AuthKit and Agendaless Consulting 2009a and 2009b for repoze.who and repoze.what.<br />
<sup>9 </sup>See <a href="http://www.makotemplates.org">http://www.makotemplates.org</a> for Mako,  <a href="http://genshi.edgewall.org">http://genshi.edgewall.org</a> for Genshi and <a href="http://jinja.pocoo.org">http://jinja.pocoo.org</a> for Jinja.</p>
<p><em>This paper is also available for </em><a href="http://blog.andrekolell.de/wp-content/uploads/2009/04/the_pylons_web_framework.pdf"><em>PDF-download</em></a><em>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrekolell.de/2009/04/26/the-pylons-web-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introduction in Pylons in Web Engineering Class</title>
		<link>http://blog.andrekolell.de/2009/04/09/introduction-in-pylons-in-web-engineering-class/</link>
		<comments>http://blog.andrekolell.de/2009/04/09/introduction-in-pylons-in-web-engineering-class/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 04:39:52 +0000</pubDate>
		<dc:creator>Andre Kolell</dc:creator>
				<category><![CDATA[(Web) Development]]></category>
		<category><![CDATA[Pylons Web Framework]]></category>
		<category><![CDATA[MICT]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[University of Western Sydney]]></category>

		<guid isPermaLink="false">http://blog.andrekolell.de/?p=507</guid>
		<description><![CDATA[During my studies at UWS I&#8217;ve got the chance to introduce Pylons to our web engineering class. I plan to finish a short report, describing the advantages and the architecture of Pylons, until April 17th. The report will be available here after it has been marked. The topics the report will cover are described in [...]]]></description>
			<content:encoded><![CDATA[<p>During my studies at UWS I&#8217;ve got the chance to introduce Pylons to our web engineering class. I plan to finish a short report, describing the advantages and the architecture of Pylons, until April 17th. The report will be available here after it has been marked. The topics the report will cover are described in a presentation I made with Google Docs:<br />
<center><iframe src='http://docs.google.com/EmbedSlideshow?docid=ddhb6jmx_93gpt28jhb' frameborder='0' width='410' height='342'></iframe></center></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrekolell.de/2009/04/09/introduction-in-pylons-in-web-engineering-class/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSL-Zugriff auf Pylons (auf Paste HTTP Server) via Apache-Proxy</title>
		<link>http://blog.andrekolell.de/2008/12/27/ssl-zugriff-auf-pylons-auf-paste-http-server-via-apache-proxy/</link>
		<comments>http://blog.andrekolell.de/2008/12/27/ssl-zugriff-auf-pylons-auf-paste-http-server-via-apache-proxy/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 18:10:40 +0000</pubDate>
		<dc:creator>Andre Kolell</dc:creator>
				<category><![CDATA[(Web) Development]]></category>
		<category><![CDATA[Pylons Web Framework]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://blog.andrekolell.de/?p=56</guid>
		<description><![CDATA[Kürzlich stand ich vor der Herausforderung, den Datentransfer mit einer online auf einem Paste HTTP Server laufenden Pylons-Instanz mit SSL zu verschlüsseln. Ich entschied mich für den Einsatz eines vorgeschaltenen Apache, wie ihn u.a. James Gardner im Kapitel &#8220;Authentication and Authorization&#8221; seines kürzlich erschienenen Buches The Definitive Guide to Pylons beschreibt. Da Jamens Gardners Ausführungen [...]]]></description>
			<content:encoded><![CDATA[<p>Kürzlich stand ich vor der Herausforderung, den Datentransfer mit einer online auf einem Paste HTTP Server laufenden Pylons-Instanz mit SSL zu verschlüsseln.</p>
<p>Ich entschied mich für den Einsatz eines vorgeschaltenen Apache, wie ihn u.a. James Gardner im Kapitel &#8220;<a href="http://pylonsbook.com/alpha1/authentication_and_authorization">Authentication and Authorization</a>&#8221; seines kürzlich erschienenen Buches <a href="http://www.amazon.de/gp/product/1590599349?ie=UTF8&amp;tag=andrwebl-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=1590599349">The Definitive Guide to Pylons</a> beschreibt. Da Jamens Gardners Ausführungen jedoch nicht umfassend genug sind und ich kein geeignetes Tutorial habe finden können, möchte ich hier knapp zusammenfassen, wie der Zugriff auf Pylons (Version 0.9.7) auf einem Paste HTTP Server bei einem bereits installierten SSL-Zertifikat (hierfür gibt es genügend Tutorials&#8230;) durch den Einsatz eines Apache-Proxy auf SSL beschränkt werden kann.</p>
<p><span id="more-56"></span>Zuerst gilt es, den SSL-Zugriff auf den Paste HTTP Server über den Apache-Proxy einzurichten. Hierfür ist die Konfiguration der virtuellen Hosts des Apache anzupassen. Diese könnte beispielsweise folgendermaßen aussehen:</p>
<blockquote>
<pre><span style="color: #993300;">NameVirtualHost *:80
NameVirtualHost *:443

&lt;VirtualHost *:80&gt;
    ServerName zu-sichernde-pylons-instanz.de
    RewriteEngine On
    RewriteRule ^/(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]
&lt;/VirtualHost&gt;

&lt;VirtualHost *:443&gt;
    ServerName zu-sichernde-pylons-instanz.de

    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl.crt/crt.crt
    SSLCertificateKeyFile /etc/apache2/ssl.key/key.key
    SSLCACertificatePath /etc/apache2/ssl.crt
    SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt

    ProxyPass / http://127.0.0.1:5000/ retry=5
    ProxyPassReverse / http://</span><span style="color: #993300;">127.0.0.1</span><span style="color: #993300;">:5000/
    ProxyPreserveHost On
    &lt;Proxy *&gt;
        Order deny,allow
        Allow from all
    &lt;/Proxy&gt;
&lt;/VirtualHost&gt;</span></pre>
</blockquote>
<p>Alle nicht SSL-verschlüsselten Anfragen (Port 80) auf die &#8220;zu-sichernde-pylons-instanz.de&#8221; werden durch diese Konfiguration auf SSL (Port 443) umgeleitet. Die SSL-verschlüsselten Anfragen werden wiederrum an den lokal auf dem Port 5000 laufenden Paste HTTP Server weitergeleitet. Normalerweise sollte nun bereits alles funktionieren.</p>
<p>Allerdings sollte noch der bis dato ggf. öffentliche Zugriff auf den Paste HTTP Server auf  den Server selbst beschränkt werden, da der Apache möglichst der einzige sein sollte, der mit dem Paste HTTP Server kommunizieren soll. Hierzu ist der Host in der development.ini anzupassen:</p>
<blockquote>
<pre><span style="color: #800000;"><span style="font-weight: bold;">[server:main]</span></span>
<span style="color: #993300;">host = 127.0.0.1
port = 5000</span></pre>
</blockquote>
<p>Das war&#8217;s dann auch schon. Eine weiterführende Diskussion, u.a. hinsichtlich des Durchreichens der Information an die Pylons-Instanz, ob es sich (ursprünglich) um eine verschlüsselte oder unverschlüsselte Anfrage handelt, findet sich in der <a href="http://groups.google.com/group/pylons-discuss/browse_thread/thread/8608a239e88cfbeb">Pylons Google Group</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrekolell.de/2008/12/27/ssl-zugriff-auf-pylons-auf-paste-http-server-via-apache-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
