Tuesday, July 17, 2007

Enable both .py and .psp in Apache2


  1. Install the mod_python module for Apache2
    (For WAMP, download mod_python.so and copy to C:\wamp\bin\apache\Apache2.2.11\modules)

  2. For WAMP only: add line
    LoadModule python_module modules/mod_python.so
    to Apache's httpd.conf file

  3. Open the default file at /etc/apache2/sites-available/
    (Note that you will need super-user privileges for editing this)
    gedit /etc/apache2/sites-available/default
    (WAMP equivalent is Apache's httpd.conf file)

  4. Go to the section
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    #Uncomment this directive is you want to see apache2's
    #default start page (in /apache2-default) when you go to /
    #RedirectMatch ^/$ /apache2-default/
    </Directory>

  5. Append this to the end of section
    AddHandler mod_python .py .psp
    PythonHandler mod_python.publisher|.py
    PythonHandler mod_python.psp|.psp
    PythonDebug On

    To read more about Apache directives, visit http://httpd.apache.org/docs/1.3/mod/mod_mime.html

  6. Restart Apache2
    /etc/init.d/apache2 restart

  7. That's all folks!
    Now you can play with .py and .psp

No comments: