Django

Differences between revisions 10 and 11
Revision 10 as of 2008-08-06 17:01:27
Size: 2041
Editor: localhost
Comment:
Revision 11 as of 2009-05-20 08:30:32
Size: 2041
Editor: mm-1-82-84-93
Comment: speling
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
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. 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 business 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.
Line 33: Line 33:
The folowing fixes can be removed when these are resolved:  The following fixes can be removed when these are resolved:

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 business 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/ If you are interested in lighttpd you can have a watch to this: http://www.djangoproject.com/documentation/fastcgi/

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 following 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/

Django (last edited 2012-04-26 13:38:07 by ww2)