Django

Revision 7 as of 2008-01-14 03:32:16

Clear message

Django is a python based web-framework. It can be found at http://www.djangoproject.com/.

In django, first you define your database models, which generate SQL for the database and allow django to know about the data. This is essential for the DRY concept. Next, the views are defined, this is where any buisness logic, interactions with the database and the like go. Then, the urls are defined as regular expression the map to views. Finally, templates are written, which are html (or anything composed of text) with data and simple data control sprinkled throughout.

Also see http://www.djangobook.com/

Django on Apache using mod_python

Install Ubuntu-Server {{{sudo apt-get install libapache2-mod-python python-django sudo vim /etc/apache2/sites-available/django-example }}}

<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    PythonDebug On
    PythonPath "['/usr/share/doc/python-django'] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE examples.settings
</Location>

{{{sudo a2dissite default sudo a2ensite django-example sudo /etc/init.d/apache2 reload}}}

Hit the box with a browser, and you should see "Django examples" and some links.

The folowing fixes can be removed when these are resolved:

2 empty files were left out of the gutsy package, django-admin.py isn't executable or in the path. {{{sudo touch /usr/share/doc/python-django/examples/init.py /usr/share/doc/python-django/examples/hello/init.py sudo chmod a+x /usr/share/python-support/python-django/django/bin/django-admin.py mkdir ~/bin ln -s /usr/share/python-support/python-django/django/bin/django-admin.py bin/ }}}