Sunday, November 22, 2009

Installing Django on Fedora Linux Apache

NB: This is a deprecated method of running django on apache. A better method can be found at

This tutorial assumes that you have webmin  installed and running. It also assumes that you know how to use su and the webmin . Check previous posts for how to install and configure webmin.

  1. Install Apache,Django, mod-python and postgreSQL
  2. yum install apache, mod-python, django, postgresql, postgresql-server

    You can install the above via yumex too.

  3. Start Apache, PostgreSQL via the Webmin module

  4. Make the Directory where your project will be hosted
  5. mkdir /home/projects

  6. Set it as a Django path
  7. cd /home/projects
    /usr/bin/django-admin startproject mysite

  8. Edit the python.conf file
  9. su
    cp /etc/httpd/conf.d/python.conf /etc/httpd/conf.d/python.conf.bak

    gedit /etc/httpd/conf.d/python.conf

    *Add the following lines
    <location "/mysite/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonDebug On
    PythonPath "['/home/projects'] + sys.path"

    *Make sure that you have this line in your configuration and its is not commented out (#)
    LoadModule python_module modules/

  10. Make sure that your site is in the apache aliases . You can add this by going to webmin->servers->Apache Webserver->Default Server->Aliases and Redirects
    Add mysite (or whatever you want to call it) and set the path to /home/projects/mysite

  11. Restart apache
  12. su
    apachectl restart

  13. Go to your browser, type in localhost/mysite (or whatever you called it in the redirects)
Blogged with the Flock Browser

No comments:

Post a Comment