← November December January →

Django meetup at 24C3

To all whom it may concern: Some djangonauts from #django-de would like to meet informally at this year’s 24C3, the Chaos Communication Congress organized by the Chaos Computer Club (CCC), Berlin Germany, probably sometime on friday afternoon. Just drop us a line at IRC or leave a comment here. And stay tuned for more.

Django Dec. 24, 2007, 2:28 p.m. comments (6)

Howto use Django on a Virtualmin server

The setup and administration of a shared-hosting server is of course quite a topic. I don’t want to go into too much detail about that, because it’s beyond the scope of this tutorial. I assume you have a running Virtualmin (Pro) server and the need to enable each user to run Django in the shared environment of your root server.

Fortunately Virtualmin Pro comes with “install scripts” that can be used to automatically install a variety of web applications to each virtual host. Naturally this works best with PHP-based apps, such as phpMyAdmin, phpBB and Wordpress. Interestingly though, it’s also able to setup the Ruby-based Rails (via rubygems) and the Perl-based MovableType. Python-based apps are missing at the moment but the developer is considering full support, including a PyPI GUI interface.

But there is good news for the impatient: An API to extend the install script functionality with Perl files. I tinkered a little to get a script ready for Django: django.pl.

Django install script

Just drop this file in your /etc/webmin/virtualmin/scripts directory and you are able to install either one of the stable versions (0.90, 0.91.1, 0.95.2, 0.96.1) or the last subversion trunk to /home/USERNAME/lib/django. The stable versions can be automatically updated once a new version is released at djangoproject.com (also bulk update on all virtual servers), while the subversion version still needs to be updated manually by running svn update /home/USERNAME/lib/django.

Hook up with mod_*

Now on finding a suitable interface to hook up your Django-based web app with the webserver, the options are: cgi, mod_fastcgi, mod_fcgid and mod_wsgi, to name a few. Luckily Virtualmin (Pro) uses mod_fcgid to run PHP, although the following instructions should also be valid for mod_wsgi or mod_fastcgi with little modification.

Once you have installed Django and uploaded your Django-based project to your virtual host (e.g. to the directory ~/lib/mysite) all you need to get up and running is:

A ~/public_html/.htaccess file containing:

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /mysite.fcgi/$1 [QSA,L]

and a ~/public_html/mysite.fcgi file containing:

#!/usr/bin/env python
import sys, os

sys.path.insert(0, os.path.expanduser("~/lib"))
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

I strongly encourage you to upload your “mysite” app to the directory lib/mysite in your home directory — putting your settings.py in your public_html directory for example is just plain dangerous.

The .htaccess file instructs the webserver to send all requests to the fastcgi process (running via mysite.fcgi) if there is no filename in the public_html directory matching the request path. Since this also applies to symbolic links you can use them to link to site_media or admin_media directories like this:

ln -s /home/USERNAME/lib/django/contrib/admin/media/ /home/USERNAME/public_html/media
or
ln -s /home/USERNAME/lib/mysite/media/ /home/USERNAME/public_html/site_media

Once the webserver receives the first request, the Django Fastcgi process gets automatically started (spawned) and waits for new requests. Please have a look in the fastcgi.py for more start options of the fastcgi process.

Django Dec. 16, 2007, 11:27 p.m. comments (4)

German Django community - Deutschsprachige Django-Community

Despite yesterday’s bitter-sweet post I’m very proud to announce the availability of a new meeting point for all German-speaking Django developers and users: Django-de. We totally owe David Larlet and his pals of Django-fr a barrel of beer since most of Django-de’s backend comes from them. Meeting cool people during the Django sprint last weekend in Dresden and afterwards also speeded things up and got this community thing started.

Our first goal should be the translation of Django’s trunk documentation which becomes 1.0’s docs in the near future, just like django.es and django-fr.org are already doing. If you’d like to participate in the growing Django community, please hop over to Django-de and get in contact with us at the Django-de Google Group or #django-de at Freenode.

PS: I know, writing this post in English seems weird to me, too.

Django Dec. 8, 2007, 10:57 p.m. comments (2)

← Previous 1 2