Django

Differences between revisions 1 and 17 (spanning 16 versions)
Revision 1 as of 2006-06-12 22:25:03
Size: 573
Editor: 81-178-107-195
Comment:
Revision 17 as of 2012-01-06 18:18:25
Size: 1647
Editor: lab200c
Comment: fixed broken link and a typo
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 regualar 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 as Python classes, to allow Django to understand the data and generate SQL for the database. This is essential for the DRY concept. Next, the views are written; this is where any business logic, interactions with the database and the like go. Then, regular expressions are defined to map requested URLs to the views previously written. 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 python-django-doc
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-doc'] + 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.


== Django on Apache using mod_wsgi ==
Deploying Django with Apache and mod_wsgi is the recommended way to get Django into production. More information [[https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/|here]].

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

In Django, first you define your database models as Python classes, to allow Django to understand the data and generate SQL for the database. This is essential for the DRY concept. Next, the views are written; this is where any business logic, interactions with the database and the like go. Then, regular expressions are defined to map requested URLs to the views previously written. 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 python-django-doc
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-doc'] + 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.

Django on Apache using mod_wsgi

Deploying Django with Apache and mod_wsgi is the recommended way to get Django into production. More information here.

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