All posts All posts by this author Paper color Change page color Announcements

Django + Apache Configuration on Ubuntu

Considering you have Django and Apache installed.
Create a new project:

~$ django-admin startproject mysite

Now edit apache configuration file:

~$ sudo vi /etc/apache2/sites-available/default

Add the following to the file just before ""

    WSGIDaemonProcess localhost python-path=/home/user/mysite
    WSGIScriptAlias /mysite /home/user/mysite/mysite/
    <Directory /home/user/mysite>
            Order deny,allow
            Allow from all

Edit the file:

~$ vi /home/user/mysite/mysite/

Add the following to the file -

import sys 

Install and enable mod_wsgi:

~$ sudo apt-get install libapache2-mod-wsgi
~$ sudo a2enmod wsgi

Restart Apache:

~$ sudo service apache2 restart

On the browser:


And it works!!!

Software Solutions