Deploying Django Applications to Apache HTTP Server (mod_python)

Official Documentation
Assumptions:
Python and Django are already installed.
You already developed a new application and would like to deploy it on Apache.

1. Install Apache HTTP Server
      (i.e. yum install httpd)
2. Install Apache Python Module (mod_python)
     (i.e. yum install mod_python)
3. Configure Apache by editing python.conf (located under <Apache_HTTP_Server_Install_ROOT>/conf.d/. On linux in the /etc directory: /etc/httpd/conf.d/python.conf).
Replace below <APPLICATION_NAME> with the name of your application located under the project directory.
<Location "/<APPLICATION_NAME>">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE <APPLICATION_NAME>.settings
    PythonPath "['<PATH_TO_DIR_CONTAINING_YOUR_APPLICATION>'] + sys.path"
    PythonDebug On
</Location>
4. Restart Apache
(i.e. service httpd restart)

5. Test by opening your web browser to http://localhost/<APLICATION_NAME>


Good luck and let me know if any problems.

Comments

Popular posts from this blog

Ant Example: Check if a directory is empty or if specific file exists.

Django (1.2.3) CRUD Using Generic Views

Creating a Custom WebSphere Portal 8 Theme with the Eclipse IDE