eEcho blog

is een halte van de gedachte

Configureren modpython ubuntu, debian

Om te installeren apache2 en mod_python voer volgende opdrachten in terminal uit.

sudo apt-get install apache2
sudo apt-get install libapache2-mod-python


Verdere configuratie

Open in tekst editor default configuratie bestand

sudo vim /etc/apache2/sites-available/default

voeg volgende regels toe

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On

# This directive allows us to have apache2’s default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>

Nu moet webserver herstart worden

sudo /etc/init.d/apache2 restart

Om installatie te testen maak een tekst bestand met ext “.py”

vim /var/www/test.py

Dat is inhoud ervan

def index(req):
  return “Test OK”;

Zo kan de test opgeroepen worden in webbrowser.

http://localhost/test

of

http://localhost/test.py

Add A Comment

You must be logged in to post a comment.

Home | info@eecho.info | Voorwaarden | Blog