{"id":3047,"date":"2013-10-23T12:38:39","date_gmt":"2013-10-23T11:38:39","guid":{"rendered":"http:\/\/www.thetawelle.de\/?p=3047"},"modified":"2020-01-11T19:13:48","modified_gmt":"2020-01-11T18:13:48","slug":"django-doing-webstuff-without-wo-or-ror","status":"publish","type":"post","link":"https:\/\/www.thetawelle.de\/?p=3047","title":{"rendered":"django \u2013 doing webstuff without WO or RoR"},"content":{"rendered":"<h3>Coming from WebObjects<\/h3>\n<p><a href=\"\/wp-upload\/norails_nowebobjects2.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3123\"  src=\"\/wp-upload\/norails_nowebobjects2.png\" alt=\"norails_nowebobjects2\" width=\"550\" height=\"267\" class=\"aligncenter size-full wp-image-3123\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/norails_nowebobjects2.png 550w, https:\/\/www.thetawelle.de\/wp-upload\/norails_nowebobjects2-300x145.png 300w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a>I once was very good at building WebApplications and Backends. I used to be a WebObjects (WO) developer. You may have never heard of WebObjects though it basically runs the complete AppStore and several of Apple&#8217;s backends for developers. One of my most successful WebObjects solutions was EverLearn, a learning environment for universities. There is still one instance of it running at LMU Munich.<\/p>\n<p>But to deploy WebObjects you have to jump through a whole lot of loops and WebObjects today is not supported with the necessary tools and IDE&#8217;s by anyone but some OpenSource guys around Project Wonder which build and maintain eclipse plugins. But working with eclipse&#8230;? No it isn&#8217;t really fun at all. But there are still <a href=\"http:\/\/de.slideshare.net\/guest439366\/building-modern-web-apps-with-webobjects-presentation\">guys around who use it<\/a>.<\/p>\n<h3>Hello python &#038; django<\/h3>\n<div style=\"margin-top:20px;border:1px solid blue;background-color:#ccddff;font-family:Helvetica,Sans-serif;padding:10px;\" class=\"roundness\">\nSo I now came to the conclusion I need some reliable backend solution which is:<\/p>\n<ol>\n<li><strong>Easy &#038; quick to learn<\/strong> and has some value beyond backend code (Python helps here)<\/li>\n<li><strong>Easy to maintain<\/strong> &#038; find some support for in a high fidelity community<\/li>\n<li><strong>Easy &#038; quick to deploy<\/strong> on any kind of box out there<\/li>\n<li>Deploys also on <strong>large scale infrastructures<\/strong> easily (say Google AppEngine)<\/li>\n<li><strong><u>Not<\/u> involving any ruby<\/strong> and ruby on rails stuff (because I hate the syntax of it a lot!)<\/li>\n<\/ol>\n<\/div>\n<p>So I will now describe my journey of how to bootstrap django skills from exactly <strong>NO SKILLS at all about python and django<\/strong>. We will see&#8230; (BTW you find a <a href=\"https:\/\/www.djangoproject.com\/s\/img\/logos\/django-logo-negative.png\">nice large django logo here<\/a>)<\/p>\n<h3>Entry vector python<\/h3>\n<p><a href=\"\/wp-upload\/django-logo.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3050\"  src=\"\/wp-upload\/django-logo.png\" alt=\"django-logo\" width=\"250\" height=\"121\" class=\"alignright size-full wp-image-3050\" \/><\/a>I started on the website called <a href=\"https:\/\/www.djangoproject.com\/\">https:\/\/www.djangoproject.com\/<\/a> and searched for some quick guide to start. I found the <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/intro\/install\/\">Quick install guide<\/a>. I entered <code>man python<\/code> on my terminal, I recognized that I need to be more specific and I typed again <code>man python2.7<\/code> and wow it was already installed and said:<\/p>\n<blockquote><p>\nPYTHON(1)<\/p>\n<p>NAME<br \/>\n       python &#8211; an interpreted, interactive, object-oriented programming language<\/p>\n<p>SYNOPSIS<br \/>\n       python [ -B ] [ -d ] [ -E ] [ -h ] [ -i ] [ -m module-name ]<br \/>\n              [ -O ] [ -OO ] [ -R ] [ -Q argument ] [ -s ] [ -S ] [ -t ] [ -u ]<br \/>\n              [ -v ] [ -V ] [ -W argument ] [ -x ] [ -3 ] [ -?  ]<br \/>\n              [ -c command | script | &#8211; ] [ arguments ]<\/p>\n<p>DESCRIPTION<br \/>\n       Python  is  an interpreted, interactive, object-oriented programming language that combines remarkable power with very clear syntax.  For an introduction to pro-<br \/>\n       gramming in Python you are referred to the Python Tutorial.  The Python Library Reference documents built-in and standard types, constants,  functions  and  mod-<br \/>\n       ules.   Finally,  the  Python  Reference  Manual  describes  the syntax and semantics of the core language in (perhaps too) much detail.  (These documents may be<br \/>\n       located via the INTERNET RESOURCES below; they may be installed on your system as well.)<\/p>\n<p>       Python&#8217;s basic power can be extended with your own modules written in C or C++.  On most systems such modules may be dynamically loaded.  Python is  also  adapt-<br \/>\n       able as an extension language for existing applications.  See the internal documentation for hints.<\/p>\n<p>       Documentation for installed Python modules and packages can be viewed by running the pydoc program.<\/p>\n<p>[\u2026]<\/p>\n<p>AUTHOR<br \/>\n       The Python Software Foundation: http:\/\/www.python.org\/psf<\/p>\n<p>INTERNET RESOURCES<br \/>\n       Main website:  http:\/\/www.python.org\/<br \/>\n       Documentation:  http:\/\/docs.python.org\/<br \/>\n       Developer resources:  http:\/\/www.python.org\/dev\/<br \/>\n       Downloads:  http:\/\/python.org\/download\/<br \/>\n       Module repository:  http:\/\/pypi.python.org\/<br \/>\n       Newsgroups:  comp.lang.python, comp.lang.python.announce<\/p>\n<\/blockquote>\n<h3>Installing django (part 1)<\/h3>\n<p>I click the link with <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/topics\/install\/#installing-official-release\">Install an official release<\/a> on it. Oh and there we have it again&#8230; the stuff that always confuses me in installation procedures. I need to install another tool to beeing able to install django. <strong>Installation Inception<\/strong> or <strong>Installation Dependency Galore<\/strong>. Anyway I just continue&#8230; installing <strong>pip<\/strong> which stands for <a href=\"http:\/\/www.pip-installer.org\/\">&#8222;A tool for installing and managing Python packages.&#8220;<\/a>. Oh and there we have it, the next inception iteration <strong>&#8222;pip requires setuptools and it has to be installed first, before pip can run.&#8220;<\/strong> yay, who would have thought&#8230;<\/p>\n<h3>Installing setuptools<\/h3>\n<p>okay lets go&#8230; I download <code>ez_setup.py<\/code> which looks to me like a python script which will do the work to install pip? But this is just wild guessing. The red security warning right next to the download link just confuses me. What the heck is a secure download? I only know trustworthy download sources\/hosts. I do not know if my curl command is secure I hope so. But should I take the &#8222;secure&#8220; install now because I do not know? I have no idea.<\/p>\n<p>I go with the &#8222;I hope it is secure approach&#8220; and type into my terminal<br \/>\n<code>curl -O https:\/\/bitbucket.org\/pypa\/setuptools\/raw\/bootstrap\/ez_setup.py<\/code><br \/>\nto get the file which should install everything. I enter the following to start installing&#8230;<br \/>\n<code>python ez_setup.py<\/code><br \/>\n&#8230;oh and boy did that <strong>not work<\/strong>. Well it seems some <strong>ez_setup.py<\/strong> script wanted to install stuff in <code>\/Library\/Python\/2.7\/site-packages\/<\/code> but this is a system directory where you need special privileges. So at this point of the installation quick guide, the instruction manual fails for the first time but yeah I already read the <strong>&#8222;(which may require administrator access)&#8220;<\/strong> part of the instruction.<\/p>\n<p>Since the only thing residing in that directory is a README, I decide to repeat the action using <strong>sudo<\/strong>. Let&#8217;s see what happens now&#8230;<br \/>\n<code>sudo python ez_setup.py<\/code><br \/>\nWow and that worked. The directory <code>\/Library\/Python\/2.7\/site-packages<\/code> now contains:<br \/>\n<code><br \/>\n-rw-r--r--  1 root  wheel     214 20 Okt 14:51 easy-install.pth<br \/>\n-rw-r--r--  1 root  wheel  481119 20 Okt 14:51 setuptools-1.1.6-py2.7.egg<br \/>\n-rw-r--r--  1 root  wheel      29 20 Okt 14:51 setuptools.pth<br \/>\n-rw-r--r--  1 root  wheel     119 22 Jul  2012 README<br \/>\n<\/code><br \/>\nFine so let&#8217;s move on&#8230;<\/p>\n<h3>Installing pip<\/h3>\n<p>I should securely download another python script named <code>get-pip.py<\/code> which I do by typing<br \/>\n<code>curl -O https:\/\/raw.github.com\/pypa\/pip\/master\/contrib\/get-pip.py<\/code><br \/>\nThen I should execute that script by typing the following (which may require administrator access)<br \/>\n<code>python get-pip.py<\/code> so I instead skip this and directly call that with <strong>sudo<\/strong> again.<br \/>\n<code>sudo python get-pip.py<\/code><br \/>\nIn this process I need to give LittleSnitch clearance for connecting to some python resource server called <code>pypi.python.org<\/code>. Since it is some .org thingy I trust it to do what is needed. It downloads <code>pip-1.4.1.tar.gz<\/code> and several seconds later it states<br \/>\n<code><br \/>\n[\u2026]<br \/>\nInstalling pip script to \/usr\/local\/bin<br \/>\nInstalling pip-2.7 script to \/usr\/local\/bin<br \/>\nSuccessfully installed pip<br \/>\n<\/code><br \/>\nSo I suppose pip is now ready to be used. Since it was installed in <code>\/usr\/local\/bin<\/code> it may easily be started from my terminal. So I leave <a href=\"http:\/\/www.pip-installer.org\/en\/latest\/installing.html\">http:\/\/www.pip-installer.org\/en\/latest\/installing.html<\/a> to get back to the django installation guide&#8230;<\/p>\n<h3>Installing django (part 2)<\/h3>\n<p>The guide says <strong>&#8222;If you\u2019re using Linux, Mac OS X or some other flavor of Unix, enter the command sudo pip install Django at the shell prompt&#8220;<\/strong> and that is what I will do now&#8230; I type&#8230;<br \/>\n<code>sudo pip install Django<\/code><br \/>\nOh well&#8230; It downloads roughly 8 MB of an archive called <code>Django-1.5.4.tar.gz<\/code> and several seconds later I read:<br \/>\n<code><br \/>\nDownloading\/unpacking Django<br \/>\n  Downloading Django-1.5.4.tar.gz (8.1MB): 8.1MB downloaded<br \/>\n  Running setup.py egg_info for package Django<\/p>\n<p>    warning: no previously-included files matching '__pycache__' found under directory '*'<br \/>\n    warning: no previously-included files matching '*.py[co]' found under directory '*'<br \/>\nInstalling collected packages: Django<br \/>\n  Running setup.py install for Django<br \/>\n    changing mode of build\/scripts-2.7\/django-admin.py from 644 to 755<\/p>\n<p>    warning: no previously-included files matching '__pycache__' found under directory '*'<br \/>\n    warning: no previously-included files matching '*.py[co]' found under directory '*'<br \/>\n    changing mode of \/usr\/local\/bin\/django-admin.py to 755<br \/>\nSuccessfully installed Django<br \/>\nCleaning up...<br \/>\n<\/code><br \/>\nI hope these warnings are shown because this is my first installation. Looks like I now have a <code>django-admin.py<\/code> sitting in my <code>\/usr\/local\/bin\/<\/code> we will see what this is good for.<\/p>\n<p>But where to go now? The installation guide just does not tell me if I am done already. I reread the part which is headlined with <strong>&#8222;Installing an official release with pip&#8220;<\/strong> but I don not see any hints what to do now.<\/p>\n<p><strong>I conclude, I am done with installation.<\/strong><\/p>\n<h3>I&#8217;ve installed things, what now?<\/h3>\n<p>Hmm, I search the site for any hint&#8230; returning to the installation intro I find a part of text headlined <strong>&#8222;Verifying&#8220;<\/strong> and it says &#8222;To verify that Django can be seen by Python, type <code>python<\/code> from your shell. Then at the Python prompt, try to import Django&#8220;.<\/p>\n<p>Okay so I type <code>python<\/code> to get into python&#8217;s Python 2.7.2 interactive shell.<br \/>\nI type <code>import django<\/code> and nothing seems to happen. Then I type <code> print(django.get_version())<\/code> and now I see:<br \/>\n<code><br \/>\n>>> import django<br \/>\n>>> print(django.get_version())<br \/>\n1.5.4<br \/>\n>>><\/code><br \/>\nThis looks like i was successful in installing stuff. And I have a feeling that all this stuff just involved python itself which was preinstalled on my Mac already. So the only dependency seems to by python which makes me smile a bit. I like that! Reading <strong>&#8222;That\u2019s it \u2013 you can now move onto the <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/intro\/tutorial01\/\">tutorial<\/a>.&#8220;<\/strong> I continue my voyage to a new country&#8230;<\/p>\n<h3>The tutorial (part 1)<\/h3>\n<p>Quickly scanning the first tutorial page I see some trouble ahead&#8230; I am quite sure that I will need to tackle problems with setting up stuff for mySQL-database activities to work for django. I have not yet configured anything for this to work, so I await some trouble here&#8230; but let&#8217;s see how far we get in this tutorial&#8230;<\/p>\n<p>First thing I learn is that I can execute django stuff from the terminal just by typing<br \/>\n<code>python -c \"import django; print(django.get_version())\"<\/code><br \/>\nwithout the need to before move into interactive python shell mode. That&#8217;s quite practical, but more specific to the python stuff I guess.<\/p>\n<h3>Going IRC&#8230;<\/h3>\n<p>At this point in time I wanted to get some advice from experts, so I entered the <code>#django<\/code>-channel on <code>irc.freenode.net<\/code> and asked for some help. I should have done this up front. But in seconds I got a very helpful advice.<br \/>\n<code>Go and google for vagrant<\/code> and <code>Google for Kenneth Love<\/code> which I did!<\/p>\n<h3>Skip all steps above and go Vagrant?<\/h3>\n<p><a href=\"\/wp-upload\/vagrant_logo.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3061\"  src=\"\/wp-upload\/vagrant_logo.png\" alt=\"vagrant_logo\" width=\"267\" height=\"78\" class=\"alignright size-full wp-image-3061\" \/><\/a> Yeah this looks like exactly what I really was searching for: <strong>A new powerhouse for easy webapp development.<\/strong> At the same time googleing for &#8222;Kenneth Love&#8220; just revealed some <a href=\"http:\/\/www.kickstarter.com\/projects\/657368266\/getting-started-with-django\">videos<\/a> to me which are produced by <a href=\"http:\/\/gigantuan.net\/\">Kenneth Love<\/a> (kind of an expert and promoter on django) and which display he is actually working on setting up resources which teach people about django on the site <a href=\"http:\/\/gettingstartedwithdjango.com\/\">http:\/\/gettingstartedwithdjango.com\/<\/a>.<\/p>\n<p>Now visiting his site displays which agenda I should have followed right from the beginning:<\/p>\n<div style=\"border:1px solid red;background-color:#ffddcc;font-family:Helvetica,Sans-serif;padding:10px;\" class=\"roundness\">\n<b>Requirements<\/b><br \/>\nYou&#8217;ve completed (at least most of) <a href=\"http:\/\/learnpythonthehardway.org\/\">Learn Python the Hard Way<\/a>.<\/p>\n<p><b>This implies you also:<\/b><\/p>\n<ol>\n<li>Have a terminal you&#8217;re comfortable with.<\/li>\n<li>Have a text editor you like.<\/li>\n<li>You&#8217;ve completed the <a href=\"https:\/\/docs.djangoproject.com\/en\/1.4\/intro\/tutorial01\/\">official Django tutorial<\/a>, also known as the Polls tutorial.<\/li>\n<li>You&#8217;ve installed both <a href=\"http:\/\/vagrantup.com\/\">Vagrant<\/a> and <a href=\"http:\/\/virtualbox.org\/\">VirtualBox<\/a>.<\/li>\n<li>You&#8217;ve <a href=\"http:\/\/s3.amazonaws.com\/GSWD\/gswd-vagrant.zip\">downloaded the VM<\/a>.<\/li>\n<\/ol>\n<\/div>\n<p>Hmm I am confused. But I think I should rather continue with the tutorial. Do not let distraction get into control.<\/p>\n<h3>The tutorial (part 2)<\/h3>\n<p>So to be a bit better prepared what will come in this tutorial I just started doing the exercises at <a href=\"http:\/\/learnpythonthehardway.org\/\">http:\/\/learnpythonthehardway.org\/<\/a> &#8230; at least I completed the first 10 exercises. With some pauses! Hey it was sunday. ;-)<br \/>\n<code><br \/>\n-rw-r--r--  1 jollyjinx  staff    42 20 Okt 23:12 ex10.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   310 20 Okt 22:53 ex9.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   465 20 Okt 22:38 ex8.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   430 20 Okt 22:30 ex7.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   438 20 Okt 22:17 ex6.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   728 20 Okt 20:42 ex5.py<br \/>\n-rw-r--r--  1 jollyjinx  staff  1072 20 Okt 20:39 ex4.py<br \/>\n-rw-r--r--  1 jollyjinx  staff  1185 20 Okt 18:47 ex3.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   248 20 Okt 18:22 ex2.py<br \/>\n-rw-r--r--  1 jollyjinx  staff   260 20 Okt 18:14 ex1.py<br \/>\n<\/code><br \/>\nMostly those first 10 exercises dealt with string assembly string formatting and escaping and string output. Also a little bit about variables and basic var types but not too much. Pretty simple stuff, but it needs time nevertheless to execute the exercises and really grab the content. During my exercises I googled for some <a href=\"http:\/\/docs.python.org\/2\/library\/stdtypes.html#string-formatting\">python documentation on string formatting<\/a> which is pretty much similar to the one in Objective-C. Actually I used <a href=\"http:\/\/sitesucker.us\/home.html\">SiteSucker<\/a> to download the content of <a href=\"http:\/\/learnpythonthehardway.org\/book\/\">http:\/\/learnpythonthehardway.org\/book\/<\/a> but please don&#8217;t tell anyone.<\/p>\n<p>So now I felt a bit better prepared to continue on the <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/intro\/tutorial01\/\">Tutorial<\/a> on the part with the headline <strong>&#8222;Creating a project&#8220;<\/strong>. So I just created a directory <code>projects<\/code> where I would store all test projects for my learning on django. Then I went into that dir and typed<br \/>\n<code>django-admin.py startproject mysite<\/code><br \/>\nNothing seemed to have happened, but&#8230; a quick<br \/>\n<code>ls -LR<\/code><br \/>\nrevealed the new created structure of the project just created:<\/p>\n<pre>\r\nmysite\r\n\r\n.\/mysite:\r\nmanage.py\tmysite\r\n\r\n.\/mysite\/mysite:\r\n__init__.py\tsettings.py\turls.py\t\twsgi.py\r\n<\/pre>\n<p>So actually one new directory named after the project name which has a <code>manage.py<\/code> and a subdirectory having 4 other python scripts inside. Nice. What now? Now I was ready to run my first python app. Yay.<br \/>\n<code>python manage.py runserver<\/code> brought it to life!<\/p>\n<h3>First light<\/h3>\n<p>After hours of stuff and learning I actually got my first web app running, what a great feeling.<br \/>\n<center><a href=\"\/wp-upload\/django_success.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3075\"  src=\"\/wp-upload\/django_success.png\" alt=\"django_success\" width=\"483\" height=\"341\" class=\"aligncenter size-full wp-image-3075\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_success.png 483w, https:\/\/www.thetawelle.de\/wp-upload\/django_success-300x211.png 300w\" sizes=\"auto, (max-width: 483px) 85vw, 483px\" \/><\/a><br \/><small>First website which runs django on my machine<\/small><\/center><br \/>\nI think the statement of <strong>&#8222;Of course, you haven&#8217;t actually done any work yet.&#8220;<\/strong> could not be more wrong at this point of my progress. I have done A LOT OF WORK to get here. But that&#8217;s how hardcore coders seem to have a different perspective on the world, they just don&#8217;t consider all the setup, documentation reading, googling, IRC-connecting, python learning, tutorial execution as <strong>WORK<\/strong>, but I DO! If you fail on these first pretty time consuming steps you won&#8217;t get anywhere near this first django website. <strong>So, thank you for my work which brought me to my first django powered site!<\/strong> (someone has to say that! and I will prevail!)<\/p>\n<h3>Let&#8217;s move on to Level 2: Database connection<\/h3>\n<p>Okay, I started editing the settings file in my django project. Then opened my mySQL database manager <a href=\"http:\/\/www.sequelpro.com\/cocoamysql\">CocoaMySQL<\/a> and created a new DB just for this tutorial. My DB config now looks like this:<br \/>\n<code><br \/>\nDATABASES = {<br \/>\n    'default': {<br \/>\n        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.<br \/>\n        'NAME': 'py_mysite_db',          # Or path to database file if using sqlite3.<br \/>\n        # The following settings are not used with sqlite3:<br \/>\n        'USER': 'root',<br \/>\n        'PASSWORD': '',<br \/>\n        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.<br \/>\n        'PORT': '',                      # Set to empty string for default.<br \/>\n    }<br \/>\n}<br \/>\n<\/code><br \/>\nBut that did not work, though I have configured everything that system was not able to connect to my mySQL database including the correct port. Doing a quick googleing on that I found that others alos have this error:<br \/>\n<code>django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb<\/code> on <a href=\"http:\/\/stackoverflow.com\/questions\/15312732\/django-core-exceptions-improperlyconfigured-error-loading-mysqldb-module-no-mo\">stackoverflow<\/a>.<\/p>\n<h3>Installing mySQL support via pip<\/h3>\n<p>I needed to install the missing mySQL module which was missing from the python site-packages. So I typed<br \/>\n<code>sudo pip install mysql-python<\/code><br \/>\nI saw some downloading, and then several warnings and finally some <strong>&#8222;Successfully installed mysql-python&#8220;<\/strong>. Okay let&#8217;s hope this works now! I knew that this would bring trouble&#8230; databases and code connecting to them&#8230; always a PITA. Everywhere! In the meantime I tried the sqlite3 option which worked on the first try, but I want the mySQL I know and use also for my blog installation to be used. I know how to deal with a mySQL and want to reuse that knowledge.<\/p>\n<p>Okay the next try wasn&#8217;t any more successful.<br \/>\n<code><br \/>\n  File \"\/Library\/Python\/2.7\/site-packages\/django\/db\/backends\/mysql\/base.py\", line 17, in &lt;module&gt;<br \/>\n    raise ImproperlyConfigured(\"Error loading MySQLdb module: %s\" % e)<br \/>\ndjango.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(\/Library\/Python\/2.7\/site-packages\/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib<br \/>\n  Referenced from: \/Library\/Python\/2.7\/site-packages\/_mysql.so<br \/>\n  Reason: image not found<br \/>\n<\/code><br \/>\nLooks like connecting a DB will be a PITA under python too. It&#8217;s a fragile connection every single time. I have never seen this work on the first or the second try under any language.<\/p>\n<p>I give up for the moment. But the stackoverflow entry has some advice on how to make it work with a lot of other PITA and statements like <strong>&#8222;Just to add to other answers, if you&#8217;re using Django, it is advisable that you install mysql-python BEFORE installing Django.&#8220;<\/strong> really make me cry.<\/p>\n<p>Someone on IRC said to me I had to reinstall mySQL, yeah sure. No way I will reinstall it it works for wordpress, so it will be good for django.<\/p>\n<p>Another advice was to check the <code>PYTHONPATH<\/code> and there we have it again&#8230; stuff that nowhere is mentioned or explaned accurately. But what exactly is PYTHONPATH? <a href=\"http:\/\/docs.python.org\/2\/using\/cmdline.html#envvar-PYTHONPATH\">Documentation<\/a> says following:<br \/>\n<code><\/p>\n<dd>\n<p>Augment the default search path for module files.  The format is the same as<br \/>\nthe shell\u2019s <span class=\"target\" id=\"index-18\"><\/span><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PATH<\/span><\/tt>: one or more directory pathnames separated by<br \/>\n<a class=\"reference internal\" href=\"..\/library\/os.html#os.pathsep\" title=\"os.pathsep\"><tt class=\"xref py py-data docutils literal\"><span class=\"pre\">os.pathsep<\/span><\/tt><\/a> (e.g. colons on Unix or semicolons on Windows).<br \/>\nNon-existent directories are silently ignored.<\/p>\n<p>In addition to normal directories, individual <span class=\"target\" id=\"index-19\"><\/span><a class=\"reference internal\" href=\"#envvar-PYTHONPATH\"><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PYTHONPATH<\/span><\/tt><\/a> entries<br \/>\nmay refer to zipfiles containing pure Python modules (in either source or<br \/>\ncompiled form). Extension modules cannot be imported from zipfiles.<\/p>\n<p>The default search path is installation dependent, but generally begins with<br \/>\n<tt class=\"file docutils literal\"><em><span class=\"pre\">prefix<\/span><\/em><span class=\"pre\">\/lib\/python<\/span><em><span class=\"pre\">version<\/span><\/em><\/tt> (see <span class=\"target\" id=\"index-20\"><\/span><a class=\"reference internal\" href=\"#envvar-PYTHONHOME\"><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PYTHONHOME<\/span><\/tt><\/a> above).  It<br \/>\nis <em>always<\/em> appended to <span class=\"target\" id=\"index-21\"><\/span><a class=\"reference internal\" href=\"#envvar-PYTHONPATH\"><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PYTHONPATH<\/span><\/tt><\/a>.<\/p>\n<p>An additional directory will be inserted in the search path in front of<br \/>\n<span class=\"target\" id=\"index-22\"><\/span><a class=\"reference internal\" href=\"#envvar-PYTHONPATH\"><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PYTHONPATH<\/span><\/tt><\/a> as described above under<br \/>\n<a class=\"reference internal\" href=\"#using-on-interface-options\"><em>Interface options<\/em><\/a>. The search path can be manipulated from<br \/>\nwithin a Python program as the variable <a class=\"reference internal\" href=\"..\/library\/sys.html#sys.path\" title=\"sys.path\"><tt class=\"xref py py-data docutils literal\"><span class=\"pre\">sys.path<\/span><\/tt><\/a>.<\/p>\n<\/dd>\n<p><\/code><\/p>\n<h3>The The Module Search Path<\/h3>\n<p>You cannot live and work with django without the <a href=\"http:\/\/docs.python.org\/2\/tutorial\/modules.html#the-module-search-path\">The Module Search Path<\/a>. But do you get it from reading this explanation? This sounds like a lot of nerdspeak to me.<br \/>\n<span id=\"tut-searchpath\"><\/span><\/p>\n<h3>6.1.2. The Module Search Path<a class=\"headerlink\" href=\"#the-module-search-path\" title=\"Permalink to this headline\">\u00b6<\/a><\/h3>\n<p id=\"index-0\">When a module named <tt class=\"xref py py-mod docutils literal\"><span class=\"pre\">spam<\/span><\/tt> is imported, the interpreter first searches for<br \/>\na built-in module with that name. If not found, it then searches for a file<br \/>\nnamed <tt class=\"file docutils literal\"><span class=\"pre\">spam.py<\/span><\/tt> in a list of directories given by the variable<br \/>\n<a class=\"reference internal\" href=\"..\/library\/sys.html#sys.path\" title=\"sys.path\"><tt class=\"xref py py-data docutils literal\"><span class=\"pre\">sys.path<\/span><\/tt><\/a>.  <a class=\"reference internal\" href=\"..\/library\/sys.html#sys.path\" title=\"sys.path\"><tt class=\"xref py py-data docutils literal\"><span class=\"pre\">sys.path<\/span><\/tt><\/a> is initialized from these locations:<\/p>\n<ul class=\"simple\">\n<li>the directory containing the input script (or the current directory).<\/li>\n<li><span class=\"target\" id=\"index-1\"><\/span><a class=\"reference internal\" href=\"..\/using\/cmdline.html#envvar-PYTHONPATH\"><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PYTHONPATH<\/span><\/tt><\/a> (a list of directory names, with the same syntax as the<br \/>\nshell variable <span class=\"target\" id=\"index-2\"><\/span><tt class=\"xref std std-envvar docutils literal\"><span class=\"pre\">PATH<\/span><\/tt>).<\/li>\n<li>the installation-dependent default.<\/li>\n<\/ul>\n<p>After initialization, Python programs can modify <a class=\"reference internal\" href=\"..\/library\/sys.html#sys.path\" title=\"sys.path\"><tt class=\"xref py py-data docutils literal\"><span class=\"pre\">sys.path<\/span><\/tt><\/a>.  The<br \/>\ndirectory containing the script being run is placed at the beginning of the<br \/>\nsearch path, ahead of the standard library path. This means that scripts in that<br \/>\ndirectory will be loaded instead of modules of the same name in the library<br \/>\ndirectory. This is an error unless the replacement is intended.  See section<br \/>\n<a class=\"reference internal\" href=\"#tut-standardmodules\"><em>Standard Modules<\/em><\/a> for more information.<\/p>\n<p>Are you any wiser now? Me not! <strong>It&#8217;s like parents explaining sex to their children, that&#8217;s how this documentation explains the PYTHONPATH.<\/strong> It&#8217;s based on too much social convention and pre-existing knowledge. It&#8217;s misleading to me and not helping at all solving my database problem.<\/p>\n<p>The big question remains, WHAT exactly is the PYTHONPATH and where do I set it, and which value does it need for my environment on the Mac to actually work? Since I have no answer to this and Google does not have a specific recommendation either&#8230; I skip this and go with the sqlite3 which runs out of the box.<\/p>\n<h3>First connect using sqlite3<\/h3>\n<p>The good thing is you can call <code>python manage.py syncdb<\/code> as often as you like. So I continued with the tutorial until I hit a road block on the <code>def __unicode__(self):<\/code> stuff. Because nowhere in the tutorial there is explained that actually you have to correctly indent stuff.<br \/>\n<code>IndentationError: expected an indented block (models.py, line 14)<\/code> will otherwise cross your console display.<\/p>\n<p>Those import-statements like <code>from django.utils import timezone<\/code> really woke memories to my java.util.* classes I used when working with WebObjects. It is still funny that those basic things do not yet belong to the default lego set of something like django.<\/p>\n<p>I got my Polls model up and was now doing exercise in the interactive python shell. I created objects, deleted them, counted them and filtered them. That was really a quite convenient experience I must say. It was way more convenient than what I did in Java long time ago. It really started be fun. But I still had none of these objects displayed on a website or so. So I went for part 2 of the tutorial.<\/p>\n<h3> Writing your first Django app, part 2 (of 6)<\/h3>\n<p>The good thing was, I already had mastered part 1, the bad thing, still 5 parts to complete. But at least I was able to do something by switching to the sqlite3 instead of getting frustrated with mySQL connection. I think I will complete on the whole tutorial just going with the sqlite3 and after all that stuff maybe I know enough to fix this mySQL mess.<\/p>\n<p>Part 2 gives some insight in how django came to life:<\/p>\n<blockquote><p>Django was written in a newsroom environment, with a very clear separation between \u201ccontent publishers\u201d and the \u201cpublic\u201d site. Site managers use the system to add news stories, events, sports scores, etc., and that content is displayed on the public site.\n<\/p><\/blockquote>\n<p>This is good news to me, because one of my main use cases I wanna execute with django is something that also is content related. Perhaps django&#8217;s roots will help me here!<\/p>\n<p>Activating the admin site did not work as expected. I got a failed webapplication instead.<br \/>\n<a href=\"\/wp-upload\/django_admin_fail.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3091\"  src=\"\/wp-upload\/django_admin_fail.png\" alt=\"django_admin_fail\" width=\"451\" height=\"450\" class=\"aligncenter size-full wp-image-3091\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_admin_fail.png 451w, https:\/\/www.thetawelle.de\/wp-upload\/django_admin_fail-150x150.png 150w, https:\/\/www.thetawelle.de\/wp-upload\/django_admin_fail-300x300.png 300w\" sizes=\"auto, (max-width: 451px) 85vw, 451px\" \/><\/a><br \/>\nThere must be something I have missed. But where to search for the cause..? Double checking on the tutorial revealed: <code>http:\/\/127.0.0.1:9999\/admin\/<\/code> needed to be opened for this to work. So I just forgot to append <strong>&#8222;\/admin\/&#8220;<\/strong>.<\/p>\n<p>So now I was successful.<br \/>\n<a href=\"\/wp-upload\/django_admin_success.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3093\"  src=\"\/wp-upload\/django_admin_success.png\" alt=\"django_admin_success\" width=\"451\" height=\"450\" class=\"aligncenter size-full wp-image-3093\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_admin_success.png 451w, https:\/\/www.thetawelle.de\/wp-upload\/django_admin_success-150x150.png 150w, https:\/\/www.thetawelle.de\/wp-upload\/django_admin_success-300x300.png 300w\" sizes=\"auto, (max-width: 451px) 85vw, 451px\" \/><\/a><\/p>\n<p>And after typing my userid and password (which I setup in part 1 of the tutorial) I saw:<br \/>\n<a href=\"\/wp-upload\/django_admin_loggedin.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3094\"  src=\"\/wp-upload\/django_admin_loggedin.png\" alt=\"django_admin_loggedin\" width=\"766\" height=\"489\" class=\"aligncenter size-full wp-image-3094\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_admin_loggedin.png 766w, https:\/\/www.thetawelle.de\/wp-upload\/django_admin_loggedin-300x191.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><\/p>\n<p>Yay!<\/p>\n<p>One error I often repeated until now was always missing on the <strong>&#8222;:&#8220;<\/strong> after the line of a class definition. That&#8217;s something I still need to learn.<\/p>\n<p>Well&#8230; stuff became more and more fun&#8230; I just worked through part 2 and customized the admin interface of the Polls app. The next big issue was just to find out where the template files of the default django admin interface were stored. After some lookup here in my blog post I found it easily and made a copy of the base site html into my fresh created templates directory:<br \/>\n<code>cp \/Library\/Python\/2.7\/site-packages\/django\/contrib\/admin\/templates\/admin\/base_site.html .<\/code><\/p>\n<p>Waaahaaa, <strong>&#8222;Where are the Django source files?&#8220;<\/strong> explanantion coming too late. Boooo! But good to know if I will ever develop on the machine of someone else. But since One-liners of python seem to be difficult to construct&#8230; this one will for sure not be at hand when needed. There is no way to teach my bash to execute this line other than putting the stuff in a shell-script file. Which actually worked and looked like this:<br \/>\n<code><br \/>\npython -c \"import sys<br \/>\nsys.path = sys.path[1:]<br \/>\nimport django<br \/>\ndjangoPath = django.__path__[0]<br \/>\noutputString = 'Django is installed at: %s' % djangoPath<br \/>\nprint(outputString)\"<br \/>\n<\/code><\/p>\n<p>Okay, several edits later and tinkering with the templates I managed to switch the whole web-app  to german language and manipulated the CSS a little bit, too. I intuitively got the concept. And what is amazing is that intuitively I found the relevant entries in the settings to switch stuff. Great!<\/p>\n<p>My web app now looked like this:<br \/>\n<a href=\"\/wp-upload\/django_admin_tweaked.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3100\"  src=\"\/wp-upload\/django_admin_tweaked.png\" alt=\"django_admin_tweaked\" width=\"795\" height=\"332\" class=\"aligncenter size-full wp-image-3100\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_admin_tweaked.png 795w, https:\/\/www.thetawelle.de\/wp-upload\/django_admin_tweaked-300x125.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><\/p>\n<h3>Tutorial part 3 (of 6)<\/h3>\n<p>Yeah I got the part 2 done. And I am not yet fed up with it. Not even a little bit. That is a good sign. So let&#8217;s go on&#8230;<\/p>\n<p>Okay, while writing all these URL mappers and views I ran into the issue that I used a special char during my commenting on all this stuff in code. Lesson learned, I now add following line to the top of all my python files.<br \/>\n<code># -*- coding: utf-8 -*-<\/code><br \/>\nSometimes I really ask myself, how many years have to pass for UTF-8 to be the default. Boy do we have innovation in computer programming languages?<\/p>\n<p>Yeah, several views and tweaks later, I got my app in a state where it now has a custom url-namespace for the polls app and it has some nice custom views for displaying index and details of the polls. I tinkered a bit with the views to do what I want and I am overall satisfied with the result.<\/p>\n<h3>Tutorial part 4<\/h3>\n<p>Okay, lots of lines of code for vews and templates later&#8230; I grabbed the concept of <strong>generic views<\/strong>. Fine. Now show me what kind of ready made generic Views are there already to be used by me?<\/p>\n<p>Actually part 4 really was still a feeling of dizzyness of understanding. But things become clear the more I tweak stuff, so in part 5 I will make &#8222;Tweaking&#8220; my basic strategy of understanding. I need to get this!<\/p>\n<h3>Tutorial part 5<\/h3>\n<p>Uh, oh, testing. Until now I was like&#8230; no tests. But seems like a good starting point using testing on a new language and lego set to ensure everything works. So let&#8217;s get to work&#8230;<\/p>\n<p><strong>Q: &#8222;So why create tests, and why now?&#8220; and A: &#8222;Tests will save you time&#8220;<\/strong> and <strong>&#8222;Code without tests is broken by design.&#8220;<\/strong> \u2013 Okay shut up and take my m&#8230; eh time and teach me.<\/p>\n<p>Okay, test are a PITA as expected. You feel like a dumbass to actually check the order of entries returned by a method. But well&#8230;<br \/>\n&#8230;in the end I wrote more code on test than anything else. During interactive testing I recognized that unix environment vars again have a huge impact on stuff. Especially the line<br \/>\n<code>export DJANGO_SETTINGS_MODULE=mysite.settings<\/code><br \/>\nhelps a lot and there <a href=\"https:\/\/docs.djangoproject.com\/en\/1.0\/topics\/settings\/\">are A LOT more<\/a>! I really need an update on these unix var thingys I never got that really to feel safe and sound. Only did the minimum by adding stuff to my bash-profile using EXPORT commands.<\/p>\n<p><code>&lt;rant&gt;<\/code>But the impact of these vars is really huge and can demolish everything you do at any time! I think this stuff should be much better protected. It&#8217;s mor like an endless pasteboard than anything. Someone should monitor all the changes to unix env vars&#8230; it&#8217;s that bad.<br \/>\nI HATE THESE UNIX ENV VARS AND WHEN SOMEONE CHANGES THEM BEHIND MY BACK!<br \/>\nFUCKTARDS GO CRASH YOUR OWN UNIX. AND NEVER TOUCH MY ENV VARS AGAIN!<br \/>\n<code>&lt;\/rant&gt;<\/code><\/p>\n<p>But hey typing <code>python manage.py test polls<\/code> now is like second nature to me. I learned!<\/p>\n<h3>Late after midnight, part 6 of 6<\/h3>\n<p>I could not resist and wanted to complete the tutorial. So I went after the <strong>&#8222;Customize your app\u2019s look and feel&#8220;<\/strong> a step in my work process I always like best.<\/p>\n<p>Adding some static resources like CSS and images was easy. Understanding the sophisticated search-strategy for static resources was a bit like trying to understand magic. But this seems more like something I will learn soon anyway by tinkering around to build reusable components\/apps thats what I am interested in the most. So <strong>&#8222;Static file namespacing&#8220;<\/strong> will become an important part, because I want to do small reusable things. That&#8217;s what worked best when I was still doing WebObjects. Components were the most powerful feature of WebObjects, and the strict split between logic and templates. The template-engine of WebObjects was one of the most logical and powerful I have seen.<\/p>\n<p>I hope I can get anywhere near that reusability of components like I once experienced that in WebObjects. I hope python\/django will deliver on this thing.<\/p>\n<p>So tinkering after midnight (while still under the impression of the Apple Keynote for the iPad Air; which inspired me to use the frontpage of apple as my tinkering background image) left me with this fine piece of crafted poll app:<\/p>\n<p><a href=\"\/wp-upload\/django_app_final.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3107\"  src=\"\/wp-upload\/django_app_final.png\" alt=\"django_app_final\" width=\"599\" height=\"742\" class=\"aligncenter size-full wp-image-3107\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_app_final.png 599w, https:\/\/www.thetawelle.de\/wp-upload\/django_app_final-242x300.png 242w\" sizes=\"auto, (max-width: 599px) 85vw, 599px\" \/><\/a><\/p>\n<p>So I consider myself now as &#8222;unchained&#8220;. <\/p>\n<p><a href=\"\/wp-upload\/django_gearup_550.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3109\"  src=\"\/wp-upload\/django_gearup_550.png\" alt=\"django_gearup_550\" width=\"550\" height=\"328\" class=\"aligncenter size-full wp-image-3109\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_gearup_550.png 550w, https:\/\/www.thetawelle.de\/wp-upload\/django_gearup_550-300x178.png 300w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a><\/p>\n<p>Let&#8217;s recap where I am now:<\/p>\n<div style=\"border:1px solid orange;background-color:#fefecc;font-family:Helvetica,Sans-serif;padding:10px;\" class=\"roundness\">\n<b>Requirements<\/b><br \/>\n<del>You&#8217;ve completed (at least most of) <a href=\"http:\/\/learnpythonthehardway.org\/\">Learn Python the Hard Way<\/a>.<\/del><br \/><b>CHECK (at least 24 of 52; will keep goin&#8216; buddy)<\/b><\/p>\n<p><b>This implies you also:<\/b><\/p>\n<ol>\n<li><del>Have a terminal you&#8217;re comfortable with.<\/del><br \/><b>CHECK (Did all in two Terminal windows using vi)<\/b><\/li>\n<li><del>Have a text editor you like.<\/del><br \/><b>CHECK (I like vi)<\/b><\/li>\n<li><del>You&#8217;ve completed the <a href=\"https:\/\/docs.djangoproject.com\/en\/1.4\/intro\/tutorial01\/\">official Django tutorial<\/a>, also known as the Polls tutorial.<\/del><br \/><b>CHECK (Did all 6 parts!)<\/b><\/li>\n<li>You&#8217;ve installed both <a href=\"http:\/\/vagrantup.com\/\">Vagrant<\/a> and <a href=\"http:\/\/virtualbox.org\/\">VirtualBox<\/a>.<\/li>\n<li>You&#8217;ve <a href=\"http:\/\/s3.amazonaws.com\/GSWD\/gswd-vagrant.zip\">downloaded the VM<\/a>.<\/li>\n<\/ol>\n<\/div>\n<h3>The journey continues&#8230;<\/h3>\n<p>next I will try to deploy the stuff somewhere and get my mySQL goin&#8216; with django which was an issue while setting up the environment for the tutorial. So by now I did everything using an sqlite3 which worked pretty well.<\/p>\n<p>I found a really <strong><a href=\"http:\/\/docs.python-guide.org\/en\/latest\/\">good documentation<\/a><\/strong> it&#8217;s called <strong>&#8222;The Hitchhiker\u2019s Guide to Python!&#8220;<\/strong> (basically in a <a href=\"https:\/\/github.com\/kennethreitz\/python-guide\">git-repo<\/a>).<\/p>\n<h3>Try to deploy<\/h3>\n<p>Okay, if you have a quick look at the deployment stuff available on the web you get the impression, that you should use a procedure called <a href=\"http:\/\/wsgi.readthedocs.org\/en\/latest\/\"> Web Server Gateway Interface (WSGI)<\/a>. <\/p>\n<blockquote><p>It is a specification for web servers and application servers to communicate with web applications.<\/p><\/blockquote>\n<p>Fine. My first guess, none of my existing hosters will support this by default. Looks kind of exotic to me. But much to my surprise there does exist a <strong>mod_wsgi<\/strong> for Apache (the webserver I know best). Oh and there is documentation available which explains <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/howto\/deployment\/wsgi\/modwsgi\/\">How to use Django with Apache and mod_wsgi<\/a>. Great!<\/p>\n<blockquote><p>Deploying Django with Apache and mod_wsgi is a tried and tested way to get Django into production.<\/p><\/blockquote>\n<p>But since that is all stuff you do not deal with everyday I just did some extensive googling oon that and came up with these two helpful resources (choosing resource 1 to follow):<\/p>\n<ol>\n<li><a href=\"http:\/\/georgeirw.in\/blog\/post\/mountain-lion-django-apache-mod-wsgi-postgres\/\">Mountain Lion, Django, Apache, mod_wsgi and Postgresql<\/a><\/li>\n<li><a href=\"http:\/\/blog.manbolo.com\/2013\/05\/02\/build-and-deploy-a-django-project-on-osx-from-scratch\">Build and Deploy a Django Project on OSX from Scratch<\/a><\/li>\n<\/ol>\n<p><a href=\"\/wp-upload\/postgres_app_icon.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3130\"  src=\"\/wp-upload\/postgres_app_icon.png\" alt=\"postgres_app_icon\" width=\"250\" height=\"280\" class=\"alignright size-full wp-image-3130\" \/><\/a>Since I got the advice to go with postgres instead of any mySQL if I want to deploy into production (which is why I am going through all this right now), I am interested in installing postgres now. I will use <a href=\"http:\/\/postgresapp.com\/\">postgres.app<\/a> for this. It&#8217;s downloading a 33 MB stuff for postgres and comes as app, how cool is that? You simply start it and it listens to default port 5432 and sits on the menubar as long as you quit it. Great! No compiling now installing, now endless commandline voodoo and unix env var wars. It. Just. Works. Thanks to those who made this app, big thanks!<\/p>\n<blockquote><p>Postgres.app is the easiest way to get started with PostgreSQL on the Mac. Open the app, and you have a PostgreSQL server ready and awaiting new connections. Close the app, and the server shuts down.<\/p><\/blockquote>\n<p>So this turns out to be actually true! Wow! I just <a href=\"http:\/\/www.pgadmin.org\/download\/macosx.php\">download an update<\/a> for my <strong>pgAdmin3<\/strong> which already resides in the Apps but is quite dated (from 2010). While the dated version does throw a lot of errors on connecting, the new version behaves quite well. So I guess I have a postgres to use now and the tools to inspect it. After adding the search path to my shell-<code>.profile<\/code> I feel well prepared.<\/p>\n<p>Entering <code>psql<\/code> gives me<br \/>\n<code><br \/>\npsql (9.3.0)<br \/>\nType \"help\" for help.<br \/>\njollyjinx=#<br \/>\n<\/code><br \/>\nYay! It just works! This is great. And the documentation which comes with postgresapp is awesome. Also getting it from the menu at any time is awesome.<\/p>\n<h3>Installing mod_wsgi in Apache (on OS X Mountain Lion)<\/h3>\n<p>Okay, to get the wsgi_mod I will need some stuff Apple did not preinstall on OS X. So installing <a href=\"http:\/\/brew.sh\/\">homebrew<\/a> by typing:<br \/>\n<code>ruby -e \"$(curl -fsSL https:\/\/raw.github.com\/mxcl\/homebrew\/go)\"<\/code><\/p>\n<p>Entering <code>brew doctor<\/code> reveals issues with my already used macports stuff. Perhaps I should try to install mod_wsgi via macports&#8230; hmm&#8230;<\/p>\n<p>Courageous as i am, I just type:<br \/>\n<code>sudo port install mod_wsgi<\/code> after I found that module in the ports list.<br \/>\nI get a whole bunch of stuff installed (dependency inception galore again)&#8230;<\/p>\n<pre>\r\n--->  Computing dependencies for mod_wsgi\r\n--->  Dependencies to be installed: apache2 apr apr-util pcre python26\r\n--->  Fetching archive for apr\r\nWarning: Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports.\r\n--->  Attempting to fetch apr-1.4.8_0.darwin_12.x86_64.tbz2 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/apr\r\n--->  Attempting to fetch apr-1.4.8_0.darwin_12.x86_64.tbz2.rmd160 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/apr\r\n--->  Installing apr @1.4.8_0\r\n--->  Activating apr @1.4.8_0\r\n--->  Cleaning apr\r\n--->  Fetching archive for apr-util\r\n--->  Attempting to fetch apr-util-1.5.2_1.darwin_12.x86_64.tbz2 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/apr-util\r\n--->  Attempting to fetch apr-util-1.5.2_1.darwin_12.x86_64.tbz2.rmd160 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/apr-util\r\n--->  Installing apr-util @1.5.2_1\r\n--->  Activating apr-util @1.5.2_1\r\n--->  Cleaning apr-util\r\n--->  Fetching archive for pcre\r\n--->  Attempting to fetch pcre-8.33_0.darwin_12.x86_64.tbz2 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/pcre\r\n--->  Attempting to fetch pcre-8.33_0.darwin_12.x86_64.tbz2.rmd160 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/pcre\r\n--->  Installing pcre @8.33_0\r\n--->  Activating pcre @8.33_0\r\n--->  Cleaning pcre\r\n--->  Fetching archive for apache2\r\n--->  Attempting to fetch apache2-2.2.25_0+preforkmpm.darwin_12.x86_64.tbz2 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/apache2\r\n--->  Attempting to fetch apache2-2.2.25_0+preforkmpm.darwin_12.x86_64.tbz2.rmd160 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/apache2\r\n--->  Installing apache2 @2.2.25_0+preforkmpm\r\n--->  Activating apache2 @2.2.25_0+preforkmpm\r\n--->  Cleaning apache2\r\n--->  Fetching archive for python26\r\n--->  Attempting to fetch python26-2.6.8_0.darwin_12.x86_64.tbz2 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/python26\r\n--->  Attempting to fetch python26-2.6.8_0.darwin_12.x86_64.tbz2.rmd160 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/python26\r\n--->  Installing python26 @2.6.8_0\r\n--->  Activating python26 @2.6.8_0\r\n\r\nTo make python 2.6 the default (i.e. the version you get when you run 'python'), please run:\r\n\r\nsudo port select --set python python26\r\n\r\n--->  Cleaning python26\r\n--->  Fetching archive for mod_wsgi\r\n--->  Attempting to fetch mod_wsgi-3.3_0+python26.darwin_12.x86_64.tbz2 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/mod_wsgi\r\n--->  Attempting to fetch mod_wsgi-3.3_0+python26.darwin_12.x86_64.tbz2.rmd160 from http:\/\/mse.uk.packages.macports.org\/sites\/packages.macports.org\/mod_wsgi\r\n--->  Installing mod_wsgi @3.3_0+python26\r\n########################################################\r\n# To enable mod_wsgi add\r\n#  LoadModule wsgi_module modules\/mod_wsgi.so\r\n# to your apache2 config file:\r\n#  \/opt\/local\/apache2\/conf\/httpd.conf\r\n########################################################\r\n--->  Activating mod_wsgi @3.3_0+python26\r\n--->  Cleaning mod_wsgi\r\n--->  Updating database of binaries: 100.0%\r\n--->  Scanning binaries for linking errors: 100.0%\r\n--->  No broken files found.\r\n<\/pre>\n<p>So I got installed &#8222;apache2&#8220;, &#8222;apr&#8220;, &#8222;apr-util&#8220;, &#8222;pcre&#8220;, &#8222;python26&#8243;&#8230; hmm&#8230; I already HAD apache2 installed. And I already had a <strong>Python 2.7.2<\/strong> installed. Hmm. This does look weird. Looks like a valid wsgi-install is only possible with <strong>python 2.6<\/strong>. So perhaps I should activate the python 2.6 installation?<\/p>\n<p>I think it is no risk to switch to python26. So I type&#8230;<br \/>\n<code>sudo port select --set python python26<\/code> which activates it and gives me <strong>Python 2.6.8<\/strong> in a new shell window. hmm, okay.<\/p>\n<p>A quick check if the existing apache2-Installation survived the ports-hoolahoop&#8230; by typing:<br \/>\n<code>sudo apachectl restart<\/code> reveals it still works. Fine, did not expect that.<br \/>\nI suppose I am set for using <strong>mod_wsgi<\/strong> in apache now (need to activate the module inside the httpd.config somewhere I suppose). We will see..<\/p>\n<p><strong>George Irwin<\/strong> writes in his <a href=\"http:\/\/georgeirw.in\/blog\/post\/mountain-lion-django-apache-mod-wsgi-postgres\/\">blog post<\/a>:<\/p>\n<blockquote><p>Now for the fiddly stuff. In short, you need to setup apache to serve your Django app (with the help of mod_wsgi).<\/p><\/blockquote>\n<p>That sounds inviting&#8230; #NOT. Anyway, I have to go through this loop at least once, before I can host stuff at some hoster around the corner. i need to figure out how much of work is needed to deploy this stuff anywhere e.g. at <a href=\"http:\/\/djangoeurope.com\/\">djangoeurope.com\/<\/a>.<\/p>\n<p>Now the excellent <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/howto\/deployment\/wsgi\/modwsgi\/\">explanantion how to set things up with Apache<\/a> is on my agenda. Perhaps i should take a short break before I go through this&#8230; <strong>*BREAK*<\/strong><\/p>\n<div style=\"font-weight:bold;font-size:24px;color:red;\">Hours (of frustration &#038; vi editing in the httpd.conf &#038; sudo apachectl restart commands) later&#8230;<\/div>\n<p>I really got frustrated in the process of using wsgi_mod and did not get it to work in my apache setup, though I configured everything as described it still revealed a server error 500. So instead I went out to <a href=\"http:\/\/www.ibm.com\/developerworks\/web\/library\/os-django\/\">http:\/\/www.ibm.com\/developerworks\/web\/library\/os-django\/<\/a> and tried to configure my apache to run with <code>mod_python<\/code> though all these django experts tell you <strong>&#8222;Hey, that&#8217;s not the way you should do it! We will drop support for mod_python in django 1.9 and it is deprecated.&#8220;<\/strong> yeah, than make it easier to setup guys!<\/p>\n<p>I really tried it a lot but still got these errors on apache:<br \/>\n<code><br \/>\n> more error_log<br \/>\n[Thu Oct 24 21:33:14 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]<br \/>\n[Thu Oct 24 21:33:14 2013] [notice] Digest: generating secret for digest authentication ...<br \/>\n[Thu Oct 24 21:33:14 2013] [notice] Digest: done<br \/>\n[Thu Oct 24 21:33:14 2013] [notice] Apache\/2.2.24 (Unix) DAV\/2 mod_wsgi\/3.3 Python\/2.6.8 PHP\/5.3.26 mod_ssl\/2.2.24 OpenSSL\/0.9.8y configured -- resuming normal operations<br \/>\n[Thu Oct 24 21:33:22 2013] [error] [client 127.0.0.1] File does not exist: \/Library\/WebServer\/Documents\/favicon.ico<br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1] mod_wsgi (pid=93168): Target WSGI script '\/Users\/jollyjinx\/djangodev\/projects\/mysite\/mysite\/wsgi.py' cannot be loaded as Python module.<br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1] mod_wsgi (pid=93168): Exception occurred processing WSGI script '\/Users\/jollyjinx\/djangodev\/projects\/mysite\/mysite\/wsgi.py'.<br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1] Traceback (most recent call last):<br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1]   File \"\/Users\/jollyjinx\/djangodev\/projects\/mysite\/mysite\/wsgi.py\", line 27, in <module><br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1]     from django.core.wsgi import get_wsgi_application<br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1] ImportError: No module named django.core.wsgi<br \/>\n[Thu Oct 24 21:33:28 2013] [error] [client 127.0.0.1] File does not exist: \/Library\/WebServer\/Documents\/favicon.ico<br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1] mod_wsgi (pid=93165): Target WSGI script '\/Users\/jollyjinx\/djangodev\/projects\/mysite\/mysite\/wsgi.py' cannot be loaded as Python module.<br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1] mod_wsgi (pid=93165): Exception occurred processing WSGI script '\/Users\/jollyjinx\/djangodev\/projects\/mysite\/mysite\/wsgi.py'.<br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1] Traceback (most recent call last):<br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1]   File \"\/Users\/jollyjinx\/djangodev\/projects\/mysite\/mysite\/wsgi.py\", line 27, in <module><br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1]     from django.core.wsgi import get_wsgi_application<br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1] ImportError: No module named django.core.wsgi<br \/>\n[Thu Oct 24 21:33:30 2013] [error] [client 127.0.0.1] File does not exist: \/Library\/WebServer\/Documents\/favicon.ico<br \/>\n<\/code><br \/>\nMy reasoning with this was&#8230; why does it use Python\/2.6.8 though I switched back already to 2.7.3?<\/p>\n<p>So I installed <code>python_select<\/code> via macports bc. I read <a href=\"http:\/\/superuser.com\/questions\/35256\/how-can-i-change-the-default-python-version-on-snow-leopard\">this<\/a>.<br \/>\n<code>sudo port install python_select<\/code><\/p>\n<p>Wow and then I really got near to cry out loud look at this mess:<br \/>\n<code><\/p>\n<pre>\r\n> port select --list python\r\nAvailable versions for python:\r\n\tnone\r\n\tpython25-apple\r\n\tpython26\r\n\tpython26-apple\r\n\tpython27 (active)\r\n\tpython27-apple\r\n<\/pre>\n<p><\/code><\/p>\n<p>Meanwhile the <strong><a href=\"http:\/\/www.editrocket.com\/articles\/python_apache_mac.html\">test.py<\/a><\/strong> I threw in <code>\/Library\/WebServer\/CGI-Executables<\/code> executed pretty fine. <\/p>\n<p><a href=\"\/wp-upload\/django_cgi_bin_test.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3133\"  src=\"\/wp-upload\/django_cgi_bin_test.png\" alt=\"django_cgi_bin_test\" width=\"717\" height=\"543\" class=\"aligncenter size-full wp-image-3133\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/django_cgi_bin_test.png 717w, https:\/\/www.thetawelle.de\/wp-upload\/django_cgi_bin_test-300x227.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><\/p>\n<p><strong>This was the code of my test.py:<\/strong><br \/>\n<code><br \/>\n#!\/usr\/bin\/python<\/p>\n<p>import sys<br \/>\npython_paths = sys.path<br \/>\npython_platform = sys.platform<br \/>\npython_version = sys.version<\/p>\n<p>print \"Content-type: text\/html\"<br \/>\nprint<br \/>\nprint \"&lt;html&gt;&lt;head&gt;\"<br \/>\nprint \"\"<br \/>\nprint \"&lt;\/head&gt;&lt;body&gt;\"<br \/>\nprint \"&lt;h1&gt;This is my Testpage&lt;\/h1&gt;\"<br \/>\nprint \"&lt;p&gt;&lt;b&gt;Python Version:&lt;\/b&gt;&lt;br&gt;%s&lt;br&gt;&lt;br&gt;&lt;b&gt;Platform:&lt;\/b&gt;&lt;br&gt;%s&lt;\/p&gt;\" % (python_version, python_platform)<br \/>\nprint \"&lt;p&gt;&lt;b&gt;Paths:&lt;\/b&gt;&lt;ul&gt;\"<br \/>\nfor current_path in python_paths:<br \/>\n        print \"&lt;li&gt;%s&lt;\/li&gt;\" % current_path<br \/>\nprint \"&lt;\/ul&gt;&lt;\/p&gt;\"<\/p>\n<p>print \"&lt;p&gt;&lt;b&gt;Django:&lt;\/b&gt;&lt;br&gt;\"<br \/>\ntry:<br \/>\n        import django<br \/>\nexcept:<br \/>\n        print \"Error: Framework not installed!\"<br \/>\nelse:<br \/>\n        print django.VERSION<br \/>\nprint \"&lt;\/p&gt;\"<\/p>\n<p>print \"&lt;\/body&gt;&lt;\/html&gt;\"<\/code><\/p>\n<p>Actually this is all a huge mess! Even using this <a href=\"http:\/\/code.google.com\/p\/modwsgi\/wiki\/CheckingYourInstallation\">CheckingYourInstallation<\/a>-procedure did not really help. I have no idea how to handle the <strong>mod_wsgi.so<\/strong>. This all sucks. on the one hand the direct python execution in my cgi-bin directory works like a charme and can even see django. On the other the damned mod_wsgi module does not get where to find <code>django.core.wsgi<\/code>??? Huge fail I say!<\/p>\n<p><strong>So again&#8230; going mod_python now&#8230;<\/strong><\/p>\n<p>And again <a href=\"http:\/\/stackoverflow.com\/questions\/855408\/running-django-on-osx\">I read<\/a>:<\/p>\n<blockquote><p>Unless you are planning on going to production with OS X you might not want to bother. If you must do it, go straight to mod_wsgi. Don&#8217;t bother with mod_python or older solutions. I did mod_python on Apache and while it runs great now, it took countless hours to set up.<\/p><\/blockquote>\n<p>&#8230;so not doing mod_python, I did not find the module anywhere, not in the default modules directory of apache, and not anywhere else. So&#8230;<br \/>\n&#8230;I suppose I will now go <a href=\"http:\/\/vagrantup.com\/\">ALL IN on VAGRANT<\/a> and <a href=\"https:\/\/www.virtualbox.org\/wiki\/Downloads\">Virtualbox<\/a>. I am fed up with it.<\/p>\n<p>I want a virtual machine which has the production environment I WANT and not a rotten to the core mess of a thousand python versions on ONE unix box alone where every version is coupled with something different. Apple shame on you creating such a mess of different python distributions even on ONE machine by default.<\/p>\n<p><a href=\"\/wp-upload\/vagrant_virtualbox.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3137\"  src=\"\/wp-upload\/vagrant_virtualbox.png\" alt=\"vagrant_virtualbox\" width=\"550\" height=\"267\" class=\"aligncenter size-full wp-image-3137\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/vagrant_virtualbox.png 550w, https:\/\/www.thetawelle.de\/wp-upload\/vagrant_virtualbox-300x145.png 300w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a><\/p>\n<h3>Installing VirtualBox &#038; Vagrant<\/h3>\n<p><code><br \/>\n> vagrant up<br \/>\nBringing machine 'default' up with 'virtualbox' provider...<br \/>\n[default] Box 'precise32' was not found. Fetching box from specified URL for<br \/>\nthe provider 'virtualbox'. Note that if the URL does not have<br \/>\na box for this provider, you should interrupt Vagrant now and add<br \/>\nthe box yourself. Otherwise Vagrant will attempt to download the<br \/>\nfull box prior to discovering this error.<br \/>\nDownloading or copying the box...<br \/>\nExtracting box...te: 3706k\/s, Estimated time remaining: 0:00:01)<br \/>\nSuccessfully added box 'precise32' with provider 'virtualbox'!<br \/>\n[default] Importing base box 'precise32'...<br \/>\n[default] Matching MAC address for NAT networking...<br \/>\n[default] Setting the name of the VM...<br \/>\n[default] Clearing any previously set forwarded ports...<br \/>\n[default] Creating shared folders metadata...<br \/>\n[default] Clearing any previously set network interfaces...<br \/>\n[default] Preparing network interfaces based on configuration...<br \/>\n[default] Forwarding ports...<br \/>\n[default] -- 22 => 2222 (adapter 1)<br \/>\n[default] Booting VM...<br \/>\n[default] Waiting for machine to boot. This may take a few minutes...<br \/>\n[default] Machine booted and ready!<br \/>\n[default] The guest additions on this VM do not match the installed version of<br \/>\nVirtualBox! In most cases this is fine, but in rare cases it can<br \/>\ncause things such as shared folders to not work properly. If you see<br \/>\nshared folder errors, please update the guest additions within the<br \/>\nvirtual machine and reload your VM.<\/p>\n<p>Guest Additions Version: 4.2.0<br \/>\nVirtualBox Version: 4.3<br \/>\n[default] Mounting shared folders...<br \/>\n[default] -- \/vagrant<br \/>\n<\/code><\/p>\n<p>And one line later&#8230;<\/p>\n<p><code><br \/>\n> vagrant ssh<br \/>\nWelcome to Ubuntu 12.04 LTS (GNU\/Linux 3.2.0-23-generic-pae i686)<\/p>\n<p> * Documentation:  https:\/\/help.ubuntu.com\/<br \/>\nWelcome to your Vagrant-built virtual machine.<br \/>\nLast login: Fri Sep 14 06:22:31 2012 from 10.0.2.2<br \/>\n<\/code><\/p>\n<p>okay now we have a virtual machine running Ubuntu 12.04 and vagrant as a kind of management tool for this machine. Let&#8217;s see how far this will bring me further to my goal of simple deployment of django\/python projects for production.<\/p>\n<p><strong>This piece of text in the vagrant help docs made me smile:<\/strong><\/p>\n<blockquote><p>Take a moment to think what just happened: With just one line of configuration and one command in your terminal, we brought up a fully functional, SSH accessible virtual machine. Cool.<\/p><\/blockquote>\n<p>Time to check back on my requirements:<\/p>\n<div style=\"border:1px solid green;background-color:#ccfecc;font-family:Helvetica,Sans-serif;padding:10px;\" class=\"roundness\">\n<b>Requirements<\/b><br \/>\n<del>You&#8217;ve completed (at least most of) <a href=\"http:\/\/learnpythonthehardway.org\/\">Learn Python the Hard Way<\/a>.<\/del><br \/><b>CHECK (at least 24 of 52; will keep goin&#8216; buddy)<\/b><\/p>\n<p><b>This implies you also:<\/b><\/p>\n<ol>\n<li><del>Have a terminal you&#8217;re comfortable with.<\/del><br \/><b>CHECK (Did all in two Terminal windows using vi)<\/b><\/li>\n<li><del>Have a text editor you like.<\/del><br \/><b>CHECK (I like vi)<\/b><\/li>\n<li><del>You&#8217;ve completed the <a href=\"https:\/\/docs.djangoproject.com\/en\/1.4\/intro\/tutorial01\/\">official Django tutorial<\/a>, also known as the Polls tutorial.<\/del><br \/><b>CHECK (Did all 6 parts! And a lot of voodoo around wsgi_mod that did not work.)<\/b><\/li>\n<li><del>You&#8217;ve installed both <a href=\"http:\/\/vagrantup.com\/\">Vagrant<\/a> and <a href=\"http:\/\/virtualbox.org\/\">VirtualBox<\/a>.<\/del><br \/><strong>CHECK installed and up and running<\/strong><\/li>\n<li><del>You&#8217;ve <a href=\"http:\/\/s3.amazonaws.com\/GSWD\/gswd-vagrant.zip\">downloaded the VM<\/a>.<\/del><br \/><strong>CHECK I have actually already 2 machines relating to one base box up and running. Will try the one linked though, too.<\/strong><\/li>\n<\/ol>\n<\/div>\n<p>Looking quite good on a <strong>Friday afternoon<\/strong>!<\/p>\n<p>Entering <code>python<\/code> on my new ubuntu box gives me<br \/>\n<code><br \/>\nPython 2.7.3 (default, Apr 20 2012, 22:44:07)<br \/>\n[GCC 4.6.3] on linux2<br \/>\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.<br \/>\n>>><\/code><\/p>\n<p>Great! Latest 2.7.3 without even installing anything. Let&#8217;s see how the apache looks or if one is installed&#8230; <code>apache2ctl<\/code> reveals<br \/>\n<strong>The program &#8218;apache2ctl&#8216; is currently not installed.  You can install it by typing:<br \/>\nsudo apt-get install apache2.2-common<\/strong><\/p>\n<p>Nice. <a href=\"http:\/\/www.howtoforge.com\/installing-apache2-with-php5-and-mysql-support-on-ubuntu-12.04-lts-lamp\">Installing a full apache setup with mysql and php<\/a> is done in under 5 minutes. Nice again.<\/p>\n<p>Cleaning up the mess is even faster.<br \/>\n<code>vagrant destroy<\/code> annd everything is back to normal\/default. Great! Now I create different setups and see which works best. Hell i could even create a shell script to automate setup of a certain box configuration. Nice. Har, har and that&#8217;s what vagrant is calling <a href=\"http:\/\/docs.vagrantup.com\/v2\/getting-started\/provisioning.html\">Provisioning<\/a>. How cool is that please?<\/p>\n<p><strong>Tinkering with vagrant &#038; virtualbox&#8230; awwwwwwwwwwwwwwwwww!!!!<\/strong><\/p>\n<p>I will never switch back to anything else. Having downloaded<br \/>\n<a href=\"http:\/\/s3.amazonaws.com\/GSWD\/gswd-vagrant.zip\">http:\/\/s3.amazonaws.com\/GSWD\/gswd-vagrant.zip<\/a> which gave me a completely configured setup for python\/django production deployment made me smile again. Hell it&#8217;s now as easy as having a &#8222;Vagrant-folder&#8220; with a &#8222;Vagrantfile&#8220; inside to setup stuff. OMG.<br \/>\n<strong>And BTW the documentation on getting started at <a href=\"http:\/\/docs.vagrantup.com\/\">http:\/\/docs.vagrantup.com\/<\/a> was one of the best I have ever had the pleasure to read.<\/strong><\/p>\n<p><a href=\"\/wp-upload\/pycharm_logo.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3153\"  src=\"\/wp-upload\/pycharm_logo.png\" alt=\"pycharm_logo\" width=\"317\" height=\"105\" class=\"alignright size-full wp-image-3153\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/pycharm_logo.png 317w, https:\/\/www.thetawelle.de\/wp-upload\/pycharm_logo-300x99.png 300w\" sizes=\"auto, (max-width: 317px) 85vw, 317px\" \/><\/a>Keep in mind to improve <a href=\"https:\/\/wiki.python.org\/moin\/BeginnersGuide\/Programmers\">python skills<\/a>. But how about really getting things going with deployment of an actual python app?<\/p>\n<p>Oh and why not start using an IDE for this too? Like e.g. <a href=\"http:\/\/www.jetbrains.com\/pycharm\/\">PyCharm<\/a>? Downloaded. Installed. Works. Great. :-)<\/p>\n<p>Using the VM of VirtualBox which was perpared by Vagrant it seemed to be easy to also activate mod_wsgi&#8230; but it wasn&#8217;t. I fiddled with nearly everything&#8230; but did not get it to run. Basically because all error messages which were generated were basically not telling me which error I have and how I could fix that.<\/p>\n<p><code><br \/>\n&lt;Directory \/var\/www\/python\/&gt;<br \/>\n  Options ExecCGI<\/p>\n<p>  AddHandler cgi-script .cgi<br \/>\n  AddHandler wsgi-script .wsgi<\/p>\n<p>  AllowOverride None<br \/>\n  Order allow,deny<br \/>\n  allow from all<br \/>\n&lt;\/Directory&gt;<br \/>\n<\/code><\/p>\n<p>Some test.wsgi was working, yeah, but my project&#8217;s wsgi-file did e.g. not end with the <code>.wsgi<\/code>-suffix but instead was named <code>wsgi.py<\/code>. But that is by far not all of the weirdnesses around deployment.<\/p>\n<p>At first I was using regularly to check if the module was really running:<br \/>\n<strong><code> apache2ctl -t -D DUMP_MODULES<\/code><\/strong><\/p>\n<h3>In the end I was stranded in deployment hell..<\/h3>\n<p><a href=\"http:\/\/www.rdegges.com\/deploying-django\/\">Deploying Django<\/a> perhaps could be made easy, but it isn&#8217;t. I suffered a lot the last 7 days! A HELL OF A LOT! I do not know if it was worth it. I am frustrated like hell. We have the year 2014 and all we have is a ballpark full of weird different technologies which in a way all do the same. We have thousands of different operating systems (OS X, debian, ubuntu, etc.), thousands of different webservers (apache, nginx, lighthttpd, etc.) we have thousands of different ways to let a webapplication interact with these webservers (mod_python, mod_wsgi, cgi-scripts, etc.) we have a zillion different python versions and fucking weird COMPILED mod_$fuck.so modules for apache which by accident NEVER are compiled in the version you actually need for the distribution which is at work on your server&#8230; <strong>It. Is. One. Frustrating. Shit. Of. A. Hell.<\/strong><\/p>\n<div style=\"text-align:center;border:5px dotted yellow;background-color:black;color:white;font-family:Helvetica,Sans-serif;padding:40px;font-size:24px;\" class=\"roundness\">And <a href=\"http:\/\/www.rdegges.com\/deploying-django\">Randall Degges<\/a> got it right!<\/div>\n<p><center><a href=\"\/wp-upload\/super_sad_smiley.png\"><img loading=\"lazy\" decoding=\"async\" data-id=\"3165\"  src=\"\/wp-upload\/super_sad_smiley.png\" alt=\"super_sad_smiley\" width=\"256\" height=\"256\" class=\"aligncenter size-full wp-image-3165\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/super_sad_smiley.png 256w, https:\/\/www.thetawelle.de\/wp-upload\/super_sad_smiley-150x150.png 150w\" sizes=\"auto, (max-width: 256px) 85vw, 256px\" \/><\/a><br \/><small>Source: <a href=\"http:\/\/de.sodahead.com\/living\/i-am-in-the-heart-of-tennessee-and-i-miss-my-babyyyyyy\/question-1511495\/?link=ibaf&#038;imgurl=http:\/\/2.bp.blogspot.com\/_uyVnrzMs9Ok\/TH5zF47Wu3I\/AAAAAAAAA74\/ty5XdmV--vs\/s400\/Sad%2BSmiley.png&#038;q=sad\">Smiley<\/a> \u2013 Current Status: Super Sad<\/small><\/center><\/p>\n<p>I am really SO close to give up on this. I mean I am not stupid, I try to learn&#8230; but this is such a huge mess WebObjects deployment now really looks easy. WebObjects Development not looks supereasy. Perhaps I should give ProjectWonder another try&#8230;<\/p>\n<p><a href=\"https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5-650x1024.png\" alt=\"\" width=\"650\" height=\"1024\" class=\"aligncenter size-large wp-image-6319\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5-650x1024.png 650w, https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5-191x300.png 191w, https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5-768x1209.png 768w, https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5-976x1536.png 976w, https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5-1200x1889.png 1200w, https:\/\/www.thetawelle.de\/wp-upload\/webobjects_5.png 1224w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><\/p>\n<h3>Har, har&#8230; got it to run!<\/h3>\n<p>ubuntu 12, apache, python, django, mod_wsgi, vagrant, virtualbox, the whole shit. :-)<\/p>\n<p><em>To be continued&#8230; in part 2. (See next blog post!)<\/em><\/p>\n<p><small><strong>Why do I blog this?<\/strong> Documenting my own progress was fun. At the same time it kept me going. And now I can also check back on all the errors I made. Seeing one&#8217;s own progress makes you confident to proceed. So now I will gear up and take the documentation as my next source of learning. I want to get stuff done! Nearly all issues I had during the tutorials were solved by my generic problemsolving skills. So I guess I am prepared to do the next steps. I am a bit afraid of the really awful <code>{% %}<\/code>-notation in templates, but I hope to not spend too much time there since I want django to be a first class REST-backend in the first place, so not many templates will be needed with some luck.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coming from WebObjects I once was very good at building WebApplications and Backends. I used to be a WebObjects (WO) developer. You may have never heard of WebObjects though it basically runs the complete AppStore and several of Apple&#8217;s backends for developers. One of my most successful WebObjects solutions was EverLearn, a learning environment for &hellip; <a href=\"https:\/\/www.thetawelle.de\/?p=3047\" class=\"more-link\"><span class=\"screen-reader-text\">\u201edjango \u2013 doing webstuff without WO or RoR\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88,80,93,67,9,19,4,36,92,2],"tags":[],"class_list":["post-3047","post","type-post","status-publish","format-standard","hentry","category-coding","category-crazeekywf","category-django","category-english","category-studien","category-everlearn","category-learning","category-mobile","category-python","category-gefunden"],"_links":{"self":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/posts\/3047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3047"}],"version-history":[{"count":0,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/posts\/3047\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}