Install Django in shared host...
The next step (after the Python 2.6 discovered) is to install Django in my shared host. Naturally my user account is not a sudoers and I don't have the root password, so the installation using the server package system is not possible.
Fortunately any Python project is quite simple to install, and Django is a Python project :D
wget http://www.djangoproject.com/download/1.3/tarball/
tar xzvf Django-1.3.tar.gz
cd Django-1.3
python2.6 setup.py install --user
Note: I used python2.6 command to show out I want to install and use it with that version of Python. Naturally if you have an alias python should be sufficient. Same thing if you want to install it using Python 2.4, in this case the --user option does not work, so the right command to run is
python setup.py install --home $HOME/.local
Then, add yur Django installation to your user PATH, setting it in .bashrc file. In your home folder run:
vi .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH
mkdir ~/public_html/kermit
cd ~/public_html/kermit
vi kermit.fcgi
#!/usr/bin/python2.6
import sys, os
Add a custom Python path.
sys.path.insert(0, "/home/user/.local/lib/python2.6")
sys.path.insert(13, "/home/user/projects/kermit")
os.environ['DJANGO_SETTINGS_MODULE'] = "webui.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
At the end of the script, as you can see, we start the fastcgi listener, to accept incoming requests.
vi .htaccess
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !^/static/
RewriteRule ^(.*)$ kermit.fcgi/$1 [QSA,L]
Basically we are configuring the Apache RewriteEngine, saying that all requests sould be sent to kermit.fcgi script except requests with /static/ in the url (my static file, like css, imgs, js, ... are there) and favicon.ico.
chmod 0755 kermit.fcgi
$ wget http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz
$ tar xzvf flup-1.0.2.tar.gz
$ cd flup-1.0.2
Like shown before, for Python 2.6/2.7:
$ python setup.py install --user
For previous versions:
$ python setup.py install --home $HOME/.local
If you want to see a first result of this test, point your browser on http://kermit.mornati.net