<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Thinking Notes</title><link href="http://thinkingnotes.net/" rel="alternate"></link><link href="http://thinkingnotes.net/feeds/all.atom.xml" rel="self"></link><id>http://thinkingnotes.net/</id><updated>2014-12-29T16:30:00-05:00</updated><entry><title>More Resources For Twisted Deferreds</title><link href="http://thinkingnotes.net/twisted-resources.html" rel="alternate"></link><updated>2014-12-29T16:30:00-05:00</updated><author><name>Notewriter</name></author><id>tag:thinkingnotes.net,2014-12-29:twisted-resources.html</id><summary type="html">&lt;div class="section" id="twisted-resources"&gt;
&lt;h2&gt;Twisted Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://twistedmatrix.com/documents/current/core/howto/defer.html"&gt;Deferred Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://twistedmatrix.com/documents/current/core/howto/gendefer.html"&gt;Generating Deferreds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://twistedmatrix.com/documents/8.1.0/api/twisted.internet.defer.Deferred.html"&gt;Twisted API: Deferred&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="other-resources"&gt;
&lt;h2&gt;Other Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://blog.mekk.waw.pl/archives/14-Twisted-inlineCallbacks-and-deferredGenerator.html"&gt;Twisted inlineCallbacks and deferredGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://hackedbellini.org/development/writing-asynchronous-python-code-with-twisted-using-inlinecallbacks/"&gt;Writing Asynchronous Python Code With Twisted Using Inlinecallbacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://krondo.com/?page_id=1327"&gt;Asynchronous Programming and the Twisted networking framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://www.youtube.com/watch?v=7Au2PDYD6Bk"&gt;Neatly Twisted&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary></entry><entry><title>Playing With Twisted and Deferreds And Returning Multiple Arguments</title><link href="http://thinkingnotes.net/playing-with-twisted-deferreds.html" rel="alternate"></link><updated>2014-12-28T16:30:00-05:00</updated><author><name>Notewriter</name></author><id>tag:thinkingnotes.net,2014-12-28:playing-with-twisted-deferreds.html</id><summary type="html">&lt;p&gt;Twisted's Deferreds is a cool way of managing callbacks.
You can return multiple arguments to the first callback but
I wanted to return more than one result for the second function.
It occurred to me I should use a tuple. Review the sample below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;    &lt;span class="c"&gt;# example.py&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;twisted.internet.defer&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Deferred&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;myCallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sex&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sex&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;trueGuy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;My full name is&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s"&gt;&amp;#39; Appleton&amp;#39;&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;My real age is&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;

    &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Deferred&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;addCallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myCallback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;Larry&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;male&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;addCallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trueGuy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;29&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This bit of code returns a tuple for the first callback.
The tuple contains the age and name information for the second callback.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; python example.py
&lt;span class="go"&gt;39 Larry male&lt;/span&gt;
&lt;span class="go"&gt;My full name is Larry Appleton&lt;/span&gt;
&lt;span class="go"&gt;My real age is 49&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This example works with a tuple. Later I will try and use a dictionary for
the same result.&lt;/p&gt;
</summary></entry><entry><title>Setting Up A Python Development Environment on Ubuntu 14.04</title><link href="http://thinkingnotes.net/setting-up-python.html" rel="alternate"></link><updated>2014-12-20T16:30:00-05:00</updated><author><name>Notewriter</name></author><id>tag:thinkingnotes.net,2014-12-20:setting-up-python.html</id><summary type="html">&lt;p&gt;This guide is for me to rmember how I setup a Python development environment
on a new machine. These steps were derived from these 2 links:&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="http://nextdime.wordpress.com/2014/07/03/how-to-set-up-python-development-environment-ubuntu-14-04/"&gt;http://nextdime.wordpress.com/2014/07/03/how-to-set-up-python-development-environment-ubuntu-14-04/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/"&gt;http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First, as always, update your sources.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get update
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then install the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get install python-dev
&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get install python-setuptools
&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get install build-essential
&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get install python-pip
&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get install sqlite3
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Upgrade pip.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; sudo pip install --upgrade pip
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With pip installed and upgraded, we can now use pip to install virtualenv and the wrapper.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; sudo pip install virtualenv
&lt;span class="gp"&gt;$&lt;/span&gt; sudo pip install virtualenvwrapper
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now modify your bashrc file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="go"&gt;if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then&lt;/span&gt;
&lt;span class="go"&gt;        export WORKON_HOME=$HOME/.virtualenvs&lt;/span&gt;
&lt;span class="go"&gt;        source /usr/local/bin/virtualenvwrapper.sh&lt;/span&gt;
&lt;span class="go"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is a basic python development environment. Please review links above for
a more comprehensive setup.&lt;/p&gt;
</summary></entry><entry><title>Bash Shell Programming</title><link href="http://thinkingnotes.net/bash-shell-programming.html" rel="alternate"></link><updated>2014-11-10T18:30:00-05:00</updated><author><name>Notewriter</name></author><id>tag:thinkingnotes.net,2014-11-10:bash-shell-programming.html</id><summary type="html">&lt;p&gt;Bash shell programming is still very handy. I will provide a quick summary
of commands and constructs.&lt;/p&gt;
&lt;div class="section" id="assigning-a-variable-and-printing-out-variable"&gt;
&lt;h2&gt;Assigning a Variable and Printing Out Variable&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;cat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Tom
&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$cat&lt;/span&gt;
&lt;span class="go"&gt;Tom&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="reading-input-into-a-variable"&gt;
&lt;h2&gt;Reading Input Into A Variable&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nb"&gt;read &lt;/span&gt;mouse
&lt;span class="go"&gt;Jerry&lt;/span&gt;
&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$mouse&lt;/span&gt;
&lt;span class="go"&gt;Jerry&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="quoting-affects-how-variables-get-printed"&gt;
&lt;h2&gt;Quoting Affects How Variables Get Printed&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;dog&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Thomas&amp;quot;&lt;/span&gt;
&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;$dog&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;dog&lt;/span&gt;
&lt;span class="gp"&gt;$&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;$dog&amp;#39;&lt;/span&gt;
&lt;span class="gp"&gt;$&lt;/span&gt;dog
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="the-if-then-elif-then-else-conditional"&gt;
&lt;h2&gt;The IF-THEN-ELIF-THEN-ELSE Conditional&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="go"&gt;if test -f hello.txt&lt;/span&gt;
&lt;span class="go"&gt;then&lt;/span&gt;
&lt;span class="go"&gt;    ...&lt;/span&gt;
&lt;span class="go"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Also written as:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="go"&gt;if [ -f hello.txt ]&lt;/span&gt;
&lt;span class="go"&gt;then&lt;/span&gt;
&lt;span class="go"&gt;    ...&lt;/span&gt;
&lt;span class="go"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For more information, look up the man page for &amp;quot;test&amp;quot;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="go"&gt;if condition&lt;/span&gt;
&lt;span class="go"&gt;then&lt;/span&gt;
&lt;span class="go"&gt;    ...&lt;/span&gt;
&lt;span class="go"&gt;elif condition&lt;/span&gt;
&lt;span class="go"&gt;then&lt;/span&gt;
&lt;span class="go"&gt;    ...&lt;/span&gt;
&lt;span class="go"&gt;else&lt;/span&gt;
&lt;span class="go"&gt;    ...&lt;/span&gt;
&lt;span class="go"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="the-for-control-structure"&gt;
&lt;h2&gt;The FOR Control Structure&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="go"&gt;for variable in collection&lt;/span&gt;
&lt;span class="go"&gt;do&lt;/span&gt;
&lt;span class="go"&gt;    ...&lt;/span&gt;
&lt;span class="go"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="go"&gt;for item in 1 2 3&lt;/span&gt;
&lt;span class="go"&gt;do&lt;/span&gt;
&lt;span class="go"&gt;    echo $item&lt;/span&gt;
&lt;span class="go"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To be continued...&lt;/p&gt;
&lt;/div&gt;
</summary></entry><entry><title>SPARQL and TWINKLE</title><link href="http://thinkingnotes.net/sparql-and-twinkle.html" rel="alternate"></link><updated>2014-11-09T21:34:00-05:00</updated><author><name>Notethinker</name></author><id>tag:thinkingnotes.net,2014-11-09:sparql-and-twinkle.html</id><summary type="html">&lt;h1&gt;SPARQL and TWINKLE&lt;/h1&gt;
&lt;p&gt;The best way to learn &lt;a href="http://en.wikipedia.org/wiki/SPARQL"&gt;SPARQL&lt;/a&gt; is 
by doing it. &lt;a href="http://www.ldodds.com/projects/twinkle/"&gt;Twinkle&lt;/a&gt;
is a great tool you can use to apply &lt;a href="http://en.wikipedia.org/wiki/SPARQL"&gt;SPARQL&lt;/a&gt; queries to
&lt;a href="http://wiki.dbpedia.org/Datasets"&gt;DBpedia&lt;/a&gt;. With Twinkle, we can execute SPARQL queries against
&lt;a href="http://wiki.dbpedia.org/Datasets"&gt;DBpedia&lt;/a&gt; and local rdf files.&lt;/p&gt;
&lt;p&gt;Download &lt;a href="http://www.ldodds.com/projects/twinkle/"&gt;zip file&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Do as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="n"&gt;unzip&lt;/span&gt; &lt;span class="n"&gt;twinkle&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zip&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;usr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;twinkle&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;add this to your &lt;em&gt;&lt;em&gt;~/.bash_alias&lt;/em&gt;&lt;/em&gt; file&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="n"&gt;twinkle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;cd /usr/local/twinkle &amp;amp;&amp;amp; java -jar twinkle.jar&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The &lt;em&gt;&lt;em&gt; /usr/local/twinkle/example &lt;/em&gt;&lt;/em&gt; folder has *.rq files containing sample queries.&lt;/p&gt;</summary><category term="SPARQL"></category><category term="Twinkle"></category><category term="graph databases"></category></entry><entry><title>Fun With Python &amp; AllegroGraph</title><link href="http://thinkingnotes.net/fun-with-python-allegrograph.html" rel="alternate"></link><updated>2013-06-13T20:30:00-04:00</updated><author><name>Notewriter</name></author><id>tag:thinkingnotes.net,2013-06-13:fun-with-python-allegrograph.html</id><summary type="html">&lt;p&gt;&lt;a class="reference external" href="http://www.franz.com/agraph/allegrograph/"&gt;AllegroGraph&lt;/a&gt; is a great NoSQL database. Not popular but it provides all
the benefits of a database without forcing schema designs on you.&lt;/p&gt;
&lt;p&gt;There is a great &lt;a class="reference external" href="http://www.franz.com/agraph/support/documentation/current/python-tutorial/python-tutorial-40.html"&gt;tutorial&lt;/a&gt; on their site.&lt;/p&gt;
&lt;p&gt;If you ever used Prolog and remember the relationships and fact building,
you can begin to imagine what you can do with AllegroGraph.&lt;/p&gt;
</summary><category term="python"></category><category term="allegrograph"></category></entry><entry><title>Setting Up Bottle with Apache mod_wsgi and virtualenv on Debian</title><link href="http://thinkingnotes.net/setting-up-bottle-with-apache-mod_wsgi-and-virtualenv-on-debian.html" rel="alternate"></link><updated>2012-09-16T22:30:00-04:00</updated><author><name>Notewriter</name></author><id>tag:thinkingnotes.net,2012-09-16:setting-up-bottle-with-apache-mod_wsgi-and-virtualenv-on-debian.html</id><summary type="html">&lt;p&gt;Deploying  &lt;a class="reference external" href="http://bottlepy.org/docs/dev/"&gt;bottle&lt;/a&gt; on &lt;a class="reference external" href="http://httpd.apache.org/"&gt;apache&lt;/a&gt; took me some time today which I hope to not
repeat. Due to some of my mistakes and errors, I tripped myself up in a mess.
I screwed up a new vhost entry on &lt;a class="reference external" href="http://httpd.apache.org/"&gt;apache&lt;/a&gt; because it defaulted back to
my &lt;em&gt;default&lt;/em&gt; entry. It took me a while to realize I needed a
ServerName entry in my new vhost file...&lt;/p&gt;
&lt;p&gt;From there I copied some crazy configurations I found through google. They
seemed geared towards some other distributions.  At the end, I was able to slim
my configuration down to several simple files that work.&lt;/p&gt;
&lt;p&gt;Lets go over the system I am working on:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/releases/stable/"&gt;debian squeeze&lt;/a&gt; - fresh install of 6.0.5&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://httpd.apache.org/"&gt;apache&lt;/a&gt; - Apache/2.2.16 (Debian) This is the &lt;a class="reference external" href="http://www.debian-administration.org/articles/207"&gt;special apache setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://bottlepy.org/docs/dev/"&gt;bottle&lt;/a&gt; - latest one from github&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.virtualenv.org/en/latest/index.html"&gt;virtualenv&lt;/a&gt; - 1.4.9&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;First step is first... make sure you can get the &lt;em&gt;default&lt;/em&gt; vhost entry
operational. I know you want to skip that step, but don't skip it.
Sometimes other things break. Make sure you can at least get that setup.
Additionally, you should create a second vhost entry with a different
ServerName.&lt;/p&gt;
&lt;p&gt;The reason you found this article is because you have many projects you want to
host on a server. You have different virtual environments for each python
project with different libraries. Keeping these projects isolated is a great
idea but serving them up isolated is better.&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;Let's go into the /opt directory as root and create a directory for my user jarvis:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
root&amp;#64;palmtree:~$ cd /opt
root&amp;#64;palmtree:/opt$ mkdir jarvis
root&amp;#64;palmtree:/opt$ chown -R jarvis:jarvis jarvis
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Let's create the virtualenv in the /opt directory:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
jarvis&amp;#64;palmtree:/opt/jarvis$ virtualenv --no-site-packages test
jarvis&amp;#64;palmtree:/opt/jarvis$ cd test
jarvis&amp;#64;palmtree:/opt/jarvis/test$ source bin/activate
jarvis&amp;#64;palmtree:/opt/jarvis/test$ mkdir src
jarvis&amp;#64;palmtree:/opt/jarvis/test$ cd src
jarvis&amp;#64;palmtree:/opt/jarvis/test/src$ touch test.py
jarvis&amp;#64;palmtree:/opt/jarvis/test/src$ touch dispatch.wsgi
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Create a test.py file for bottle to run:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
from bottle import route, run, request

&amp;#64;route('/', method='GET')
def index1():
    return '&amp;lt;h1&amp;gt;HELLO&amp;lt;/h1&amp;gt;'

&amp;#64;route('/hello/:name', method='GET')
def index(name='World'):
    return '&amp;lt;b&amp;gt;Hello %s!&amp;lt;/b&amp;gt;' % name
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Create a dispatch.wsgi file for apache to run:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
import sys, os

# ... build or import your bottle application here ...
import bottle
import test

# Do NOT use bottle.run() with mod_wsgi
application = bottle.default_app()
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Go to your apache sites-available directory and copy the default vhost into a new entry:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
root&amp;#64;palmtree:~# cd /etc/apache2/sites-available/
root&amp;#64;palmtree:~# cp default test
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Grab your favorite editor and edit the new vhost entry called &lt;strong&gt;test&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
&amp;lt;VirtualHost *:80&amp;gt;
ServerName test.example.net

WSGIDaemonProcess ptest display-name=%{GROUP}\
 threads=4 \
 python-path=/opt/jarvis/test/src:/opt/jarvis/test/lib/python2.6/site-packages
WSGIProcessGroup ptest
WSGIScriptAlias / /opt/jarvis/test/src/dispatch.wsgi

Alias /robots.txt /opt/jarvis/test/src/apache_static/robots.txt
Alias /favicon.ico /opt/jarvis/test/src/apache_static/favicon.ico

&amp;lt;Directory /opt/jarvis/test/src&amp;gt;
Order allow,deny
Allow from all
&amp;lt;/Directory&amp;gt;

ErrorLog ${APACHE_LOG_DIR}/test_error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

 CustomLog ${APACHE_LOG_DIR}/test_access.log combined
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Activate the conf file, and restart Apache:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
root&amp;#64;palmtree:~# a2ensite test
root&amp;#64;palmtree:~# services apache resart
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The key to getting this simple configuration to work is in step 6.
The line with &lt;strong&gt;python-path&lt;/strong&gt; needs the path to the test.py bottle file
and the site-packages directory for the virtualenv that was created.
Hopefully this works for you!&lt;/p&gt;
</summary><category term="python"></category><category term="virtualenv"></category><category term="bottle"></category><category term="wsgi"></category><category term="debian"></category></entry></feed>