This shows you the differences between two versions of the page.
ejecucion_de_scripts_python_con_apache [18/05/2009 00:00] |
ejecucion_de_scripts_python_con_apache [18/05/2009 00:00] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Ejecución de scripts Python con Apache ====== | ||
+ | <note> | ||
+ | Borrador. Ver si esto nos podría servir para invocar desde un navegador los scripts de mantenimiento de OpacMarc. | ||
+ | </note> | ||
+ | |||
+ | Según indicaciones en http://www.campstaff.com/manual/mod/mod_python/inst-testing.html | ||
+ | |||
+ | .htaccess | ||
+ | <code apache> | ||
+ | AddHandler mod_python .py | ||
+ | PythonHandler mptest | ||
+ | PythonDebug On | ||
+ | </code> | ||
+ | |||
+ | mptest.py | ||
+ | <code python> | ||
+ | from mod_python import apache | ||
+ | |||
+ | def handler(req): | ||
+ | req.content_type = 'text/plain' | ||
+ | req.write("Hello World!") | ||
+ | return apache.OK | ||
+ | </code> | ||
+ | |||
+ | (Nótese que con esta prueba, nada importa lo que haya en test.py; cualquier llamada a un ".py", existente o no, produce lo mismo) | ||
+ | |||
+ | |||
+ | {{tag>apache python}} |