Django

Differences between revisions 15 and 16
Revision 15 as of 2010-03-05 13:05:58
Size: 1416
Editor: 17
Comment: example app contains in the python-django-doc package
Revision 16 as of 2011-06-15 10:53:18
Size: 1647
Editor: 205
Comment:
Deletions are marked like this. Additions are marked like this.
Line 31: Line 31:


== Django on Apache using mod_wsgi ==
Deploying Django with Apache and mod_wsgi is the recommended way to get Django into production. More informacion [[https://docs.djangoproject.com/en/dev/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 informacion here.

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