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.
(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.
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>">4. Restart Apache
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>
(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
Post a Comment