I am looking for step by step details of how to deploy django websites in apache2 server with one example. I am using ubuntu operating system

Please give some link or give the details.

I use apache for Django 1.1.1 deployment under Debian, but Ubuntu must be all the same.
This could be an example:
1-Install an activate python module for apache:
sudo apt-get install libapache2-mod-python
sudo a2enmod python
sudo /etc/init.d/apache2 restart

2-Guess you have your project located at /srv/my_site
cd /srv/
sudo django-admin.py startproject my_site

3-Make a virtualhost for it:
sudo edit /etc/apache2/sites-available/my_site.com
<VirtualHost *:80>
ServerAdmin me@localhost
ServerName mysite.com
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE videoteca.settings
PythonPath " + sys.path"
#You can activate Python debug
#PythonDebug On
order allow,deny
allow from all

#We will serve media under /media
Alias /media /srv/my_site/media
<Location "/media">
SetHandler None
Options FollowSymLinks

#We will serve the admin media under /adminmedia
Alias /adminmedia /srv/my_site/adminmedia
<Location "/adminmedia">
SetHandler None
Options FollowSymLinks

#Contents that python does not handle are handled by apache directly
<LocationMatch "\.(jpg|gif|png|swf|css|js|flv|mp3|xml)$">
SetHandler None

#We do not want for encoding troubles
AddDefaultCharset utf-8

4-Edit settings.py and adjust settings, these are some things you shoul set:
sudo edit /srv/my_site/settings.py

MEDIA_ROOT = '/srv/my_site/media/'
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/adminmedia/'

If you use sqlite database, you must specify the complete path to your database:
DATABASE_NAME = '/srv/my_site/my_database.db'

5-Make a symbolic link to admin media. In my case it's located at /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/, but it can be at other place on your system:
cd /srv/my_site
sudo ln -s /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/ adminmedia

6-Make apache user the owner of the directory, so it can modify the database file, de media directory so you can make uploads, etc.
sudo chown -R www-data.www-data /srv/my_site

7-Enable your apache virtualhost:
sudo a2ensite my_site.com
sudo /etc/init.d/apache2 reload

8-Set mysite.com on your virtualhost for testing purposes:
sudo edit /etc/hosts localhost mysite.com

Make ping to mysite.com to be sure it responds to your loop interface:
ping mysite.com
PING localhost ( 56(84) bytes of data.
64 bytes from localhost ( icmp_req=1 ttl=64 time=0.090 ms
64 bytes from localhost ( icmp_req=2 ttl=64 time=0.047 ms
64 bytes from localhost ( icmp_req=3 ttl=64 time=0.060 ms
64 bytes from localhost ( icmp_req=4 ttl=64 time=0.057 ms
--- localhost ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.047/0.063/0.090/0.017 ms

9-Open site on your browser:
firefox mysite.com

Hope be helpfull.

This question has already been answered. Start a new discussion instead.