1. Jochen Breuer
  2. django_hoster


Clone wiki

django_hoster / Home


This project is dead. You can find a much better deployment approach here called basalt. basalt also lets you generate parameterized configs, which was the goal of django_hoster.


django_hosters aim is to create django hosting environements on the fly. You just give django_host an context and django_hoster creates all the configs, folders and files needed to start hosting a new django project. Right now django_hoster is in an very early state and offers not much comfort, also everything works. You will have to run django_hoster from shell - so there is no fancy web interface.

What is needed ?

django_hoster is a django project itself. So you need django >= 1.0 installed. django_hoster also makes use of the crypt module. You need to install python-crypto (debian - other linux might use other package names) on your system.

The configs django_hoster creates are for a very specific environment. You will have to have apache with mod_wsgi, webalizer and your media files will be made available via a separate vhost under a sub-domain. Stats are made available via webalizer that uses basic auth to protect access.

Set up django_hoster

django_hoster comes with a 'settings_local.py'. Here you will have to set some paths and (very important) the uid and gid of the webserver user. Usually that would be the ids of 'www-data'.

HTPASSWD => Password to access the webalizer stats.

PATH_SITE_CONFIG => The path your apache-site-config goes. E. g. /etc/apache/sites-available

PATH_WEBALIZER_CONFIG => I am using webalizer. So you will have to stick with it for the moment. ;)

PATH_WWW_BASE => On debian that would be /var/www.


As mentioned above, django_hoster has no web interface right now and you will have to use the django shell.

$ ./manage.py shell

If you take a look at the model.py in the project_creator app you will find from line 22 to 43 the context dict. Those are the information needed as fodder for the ProjectCreator.

On the shell you will have to do something like this:

from project_creator.models import ProjectCreator

context = {
    'project_name':         'example',
    'server_ip':            '*',
    'server_port':          80,
    'server_name':          'example.com',
    'server_alias':         ('www.example.com', 'www2.example.com'),
    'server_admin':         'admin@example.com',
    'wsgi_daemon_process':  'example.com',
    'www_user':             'www-data',
    'www_group':            'www-data',
    'processes':            3,
    'threads':              25,

x = ProjectCreator(context)

If everything worked fine, your basic structure should be created and alle needed configs are at place.


django_hoster makes use of the django templates to create the config files. Also the solution is pramatic I would prefere to have a more sophisticated solution. Therefore it is planned to replace the templated based system with Augeas. Augeas would also give the opportunity to edit the configs later.

Oh, and a web interface is planned too! :)

Try it out and report bugs. Have fun!