<?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>SenseHofstede.nl &#187; python</title>
	<atom:link href="http://sensehofstede.nl/tag/python/feed" rel="self" type="application/rss+xml" />
	<link>http://sensehofstede.nl</link>
	<description>Sense&#039;s blog</description>
	<lastBuildDate>Thu, 29 Jul 2010 23:52:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Get mod_python working</title>
		<link>http://sensehofstede.nl/get-mod_python-working</link>
		<comments>http://sensehofstede.nl/get-mod_python-working#comments</comments>
		<pubDate>Sun, 06 Apr 2008 13:54:32 +0000</pubDate>
		<dc:creator>Sense Hofstede</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[English Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.qense.nl/?p=78</guid>
		<description><![CDATA[With just installing the package libapache2-mod-python you&#8217;re not done yet. I tried to get it working but it turned out that I had to adapt the configuration files by myself. This is not how it should be in my eyes, &#8230; <a href="http://sensehofstede.nl/get-mod_python-working">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With just installing the package libapache2-mod-python you&#8217;re not done yet. I tried to get it working but it turned out that I had to adapt the configuration files by myself. This is not how it should be in my eyes, since beginning Ubuntu users will have a hard time to get it working. Anyway, I&#8217;m going to file a bug after this post has been post.<br />
I based my guide on the official mod_python documentation, which can be found here: <a href="http://www.modpython.org/live/current/doc-html/">Mod_python Manual</a>.</p>
<p>The first step was to let apache send .py files to the python module to parse them. This is done by adding this following code to <em>/etc/apache2/sites-available/default</em>.</p>
<blockquote><p>AddHandler mod_python .py<br />
PythonHandler mod_python.publisher<br />
PythonDebug On</p></blockquote>
<p>Add this before &lt;/Directory&gt; in the &lt;Directory &gt;&lt;/Directory&gt; structure of the directory you want to enable python in. Make sure you restart apache now.</p>
<p>Now you want to execute some python code. This isn&#8217;t the same as with PHP. You can&#8217;t just write <em>print &#8220;Hello World&#8221;</em> and the browser will display Hello World. The handler works with different modules. You have to define in your file and request it with your URI. I&#8217;ll show you this with the example code from the documentation. Paste this in a file and save it as test.py:</p>
<pre>#!/usr/bin/python

""" Publisher example """
def say(req, what="NOTHING"):
return "I am saying %s" % what</pre>
<p>This code defines the module say. You can execute it by going to http://localhost/test.py/say if you&#8217;ve saved it in your server root. You probably already saw the variable what, which is passed on. This variable can be passed on in this way: http://localhost/test.py/say?what=hi<br />
The module name for the default one, if no module name is passed on is <em>index</em>. http://localhost/test.py will look for the module <em>index</em> and if that isn&#8217;t present it will return a 404 error. Please make sure you pass <em>req</em> on in every definition of a module. Note that if a non-existing module is requested a 404 error will be sent to the browser.</p>
<p>A note: Apache is restarted with <em>sudo apache2 -k restart</em>. If that doesn&#8217;t work for you, you can try it with <em>sudo dpkg-reconfigure apache2-mpm-prefork</em>.</p>
<p>If you find any errors in this blog post or think that certain things are incomplete or can be done better, please don&#8217;t hestitate to tell me. I&#8217;m not that experienced with python. <img src='http://sensehofstede.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sensehofstede.nl/get-mod_python-working/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Storm</title>
		<link>http://sensehofstede.nl/storm</link>
		<comments>http://sensehofstede.nl/storm#comments</comments>
		<pubDate>Sat, 05 Apr 2008 15:04:21 +0000</pubDate>
		<dc:creator>Sense Hofstede</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[English Posts]]></category>
		<category><![CDATA[caws]]></category>
		<category><![CDATA[launchpad]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.qense.nl/?p=77</guid>
		<description><![CDATA[There has been a lot of discussion about Launchpad not being completely open-source. I don&#8217;t mind, but others do(although I&#8217;d really love to use/see parts of Launchpad). The one part that Canonical did release was Storm, an Object-Relational Mapper. The &#8230; <a href="http://sensehofstede.nl/storm">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There has been a lot of discussion about Launchpad not being completely open-source. I don&#8217;t mind, but others do(although I&#8217;d really love to use/see parts of Launchpad).</p>
<p>The one part that Canonical did release was Storm, an <a title="ORM" href="http://en.wikipedia.org/wiki/Object-relational_mapping">Object-Relational Mapper</a>. The definition Wikipedia gives is:</p>
<p>&#8220;<strong>Object-Relational Mapping</strong> (aka <strong>ORM</strong>, <strong>O/RM</strong>, and <strong>O/R mapping</strong>) is a <a class="mw-redirect" title="Programming" href="http://en.wikipedia.org/wiki/Programming">programming</a> technique for converting data between incompatible <a title="Type system" href="http://en.wikipedia.org/wiki/Type_system">type systems</a> in <a title="Relational database" href="http://en.wikipedia.org/wiki/Relational_database">relational databases</a> and <a class="mw-redirect" title="Object-oriented" href="http://en.wikipedia.org/wiki/Object-oriented">object-oriented</a> programming languages. This creates, in effect, a &#8220;virtual <a title="Object database" href="http://en.wikipedia.org/wiki/Object_database">object database</a>&#8221; which can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.&#8221;</p>
<p>It is, in plain English, a way to make lineair stuff from the database object oriented, and make an easy way to display the relations between it. Launchpad uses it for example for teams and their members.</p>
<p>I&#8217;ve been looking at Python as a web programming language a lot lately and I even think of making CAWS Python, with Storm as a part of it. But I don&#8217;t know what the other two would think of that. <img src='http://sensehofstede.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  But it sure looks promissing and I think it can be a great language.</p>
<p>The only problem is that I couldn&#8217;t make mod_python to work in Apache. DotPy files are still offered to be downloaded when I try to access them at my local server(read my own computer). When I&#8217;ve found a sollution I&#8217;ll post it at this blog, since I couldn&#8217;t find anything that worked. I&#8217;ll also post some code when I&#8217;ve written something with Storm. But first I want to finish the website of Project Paragon and a part of the school website. <img src='http://sensehofstede.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The website of Storm can be found here: <a href="https://storm.canonical.com/">FrontPage &#8211; Storm</a>.<br />
It contains a not that clear, but interesting Tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://sensehofstede.nl/storm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
