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.
Hello! I am developing a POS System. I have need to print Sales receipt. I have no physical printer to test my printing but i have print on xps document. ...
so i tried adding a defintion for the reset command but it doesn't seemed like it works
other method was moving the defintion around the localfunction which didn't work and ...
Hi I am learning python and there is these two code snippets but I keep getting an error when I try to run the program.
# survey.py class AnonymousSurvey(): # ...