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
sudo django-admin.py startproject my_site
3-Make a virtualhost for it:
sudo edit /etc/apache2/sites-available/my_site.com
SetEnv DJANGO_SETTINGS_MODULE videoteca.settings
PythonPath " + sys.path"
#You can activate Python debug
allow from all
#We will serve media under /media
Alias /media /srv/my_site/media
#We will serve the admin media under /adminmedia
Alias /adminmedia /srv/my_site/adminmedia
#Contents that python does not handle are handled by apache directly
#We do not want for encoding troubles
MEDIA_ROOT = '/srv/my_site/media/'
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/adminmedia/'
TEMPLATE_DIRS = (
If you use sqlite database, you must specify the complete path to your database:
DATABASE_ENGINE = 'sqlite3'
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:
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
Make ping to mysite.com to be sure it responds to your loop interface:
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.090 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.047 ms
64 bytes from localhost (127.0.0.1): icmp_req=3 ttl=64 time=0.060 ms
64 bytes from localhost (127.0.0.1): 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:
Hope be helpfull.
I am trying to understand the SynchronizedMap and I ran the below code. I get the below Output with an exception. According to my understanding the exception is caused when ...
I am trying to make this form to clear after being submited. As it is now the form submits, however, the input fields do not clear and when ...
So, the title may seem confusing so hopefully I am able to explain myself better via the thread body. I am developing an application for a friend that wants to ...