Buscar en moleculax

Este blog es un ensayo digital donde el pensamiento estructurado se encuentra con la introspección profunda. Explora la arquitectura del conocimiento: desde lo técnico hasta los fundamentos éticos. Aquí, cada algoritmo tiene propósito, cada línea de código refleja intención, y cada reflexión filosófica busca optimizar no solo sistemas, sino también decisiones humanas. Este blog no solo enseña a pensar, enseña a discernir, a construir con sentido. Porque el verdadero desarrollo nace de la conciencia, y eso exige precisión, virtud y coraje.

Tenemos que aprender a contemplar las potenciales consecuencias de nuestros planes, para impedir que nos sorprendan. De esta manera, tendremos más control sobre las situaciones difíciles ya que el verdadero progreso no se mide por la velocidad con la que avanzamos, sino por la dirección que elegimos. En un mundo cada vez más interconectado, el desarrollo de la humanidad exige más que tecnología y conocimiento: requiere conciencia, empatía y propósito.

Debemos cultivar una inteligencia que no solo resuelva problemas, sino que los prevenga con sabiduría. Una ciencia que no solo descubra, sino que se pregunte por qué y para quién. Una economía que no solo crezca, sino que reparta con justicia. Y una cultura que no solo celebre lo diverso, sino que lo abrace como fuerza vital.

Cada decisión que tomamos, cada palabra que decimos, cada idea que compartimos, puede ser una semilla de transformación. El futuro no está escrito: lo estamos escribiendo juntos, ahora mismo.

Que el desarrollo humano sea integral, sostenible y profundamente humano. Porque solo cuando elevamos a todos, nos elevamos como especie.

Sabiduría Justicia Templanza Coraje
Embedding Python In Apache2 With mod_python

 This tutorial shows how to install and use mod_python on a Debian Etch server with Apache2. mod_python is an Apache module that embeds the Python interpreter within the server. It allows you to write web-based applications in Python that will run many times faster than traditional CGI and will have access to advanced features such as ability to retain database connections and other data between hits and access to Apache internals.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

I have tested this on a Debian Etch server with the IP address 192.168.0.100 where Apache2 is already installed.
I'm using a virtual host with the document root /var/www in this example.

 

2 Installing mod_python

To install mod_python, we simply run:
apt-get install libapache2-mod-python
 

3 Configuring Apache

Now we must configure Apache so that it can handle Python files. There are two ways of doing so. The first (and default) one is to use the Publisher Handler. It allows you to write pure Python scripts with the extension .py that will be interpreted by Apache. The second way is the PSP Handler. PSP stands for Python Server Pages. It allows you to embed Python code directly in HTML code, similar to PHP. PSP files have the extension .psp.

3.1 The Publisher Handler

To enable the Publisher Handler, we must open our vhost configuration (I'm using the default vhost on Debian with the document root /var/www; the configuration for this vhost is located in /etc/apache2/sites-available/default) and add the lines AddHandler mod_python .py, PythonHandler mod_python.publisher, and PythonDebug On to it:

vi /etc/apache2/sites-available/default

[...]
        
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                AddHandler mod_python .py
                PythonHandler mod_python.publisher
                PythonDebug On
        
[...]

Restart Apache afterwards:

/etc/init.d/apache2 restart

Now we create a little Python test script (e.g. /var/www/test.py) with pure Python code in it...

vi /var/www/test.py

def index(req):
  return "Test successful";

... and call it in a browser (e.g. http://192.168.0.100/test.py). If all goes well, it should display Test successful in your browser.

3.2 The PSP Handler

To enable the Publisher Handler, we must open our vhost configuration (I'm using the default vhost on Debian with the document root /var/www; the configuration for this vhost is located in /etc/apache2/sites-available/default) and add the lines AddHandler mod_python .psp, PythonHandler mod_python.psp, and PythonDebug On to it:

vi /etc/apache2/sites-available/default
[...]
        
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                AddHandler mod_python .psp
                PythonHandler mod_python.psp
                PythonDebug On
        
[...]
Restart Apache afterwards:
/etc/init.d/apache2 restart
Now we create a little PSP test script (e.g. /var/www/test.psp) with HTML and Python code in it...

vi /var/www/test.psp



<% req.write("Hello!") %>

... and call it in a browser (e.g. http://192.168.0.100/test.psp). If all goes well, it should display Hello! in your browser.

4 Python Modules

If you need further Python modules, you can search for them like this:
apt-cache search python
Pick the ones you need and install them as follows:
apt-get install python-mysqldb python-xml
Restart Apache afterwards:
/etc/init.d/apache2 restart

.

agenda 2023 (1) Algo que leer (265) Android (2) Angular (2) Apache (6) API (1) Arte y Cultura (11) Artes Marciales (10) Banner (1) Base de datos (33) Batalla Cultural (4) Big Data (12) Budismo (4) cabala judia (2) Calculo Asistido por computadoras (2) Canaima (6) Caos (1) Ceo (1) ciencias (1) Cine (1) Cobol (12) Cobra Kai (1) Codigo Linux Documental (2) Computación (3) Computación forense (14) Configurando Samba (1) Conocimiento (1) Consola (8) contenedores (5) Criptomonedas (3) Cultura (1) Cursos (15) Darkweeb (3) Data Mining (1) Debian (12) DeepWeb (7) demografia (8) Deporte y Recreación (9) Deportes (10) desclasificados (7) Desktop (1) developers (1) Docker (6) Document (1) Ecología (6) Editor (3) Editores (4) Educacion y TIC (31) Electronica (2) Emprendimiento (7) Espiritualidad (2) estoicismo (4) Eventos (2) Excel (1) Express (1) fedora (1) Filosofía (25) Flisol 2008 (3) Flisol 2010 (1) Flisol 2015 (1) framework (1) Funny (1) Geografía (1) Gerencia y Liderazgo (72) Gestor de Volúmenes Lógicos (1) Git (7) GitHub (8) Globalizacion (5) gnu (28) Go (1) gobiernos (2) golang (2) Google por dentro (1) GraphQL (1) gRPC (1) Hackers - Documental (8) Hacking (31) Historia (3) howto (189) html (1) IA (19) IntelliJIDEA (1) Internet (6) Introducción a los patrones (2) J SON (1) java (51) java eclipse (2) javaScript (8) JDK (1) jiujitsu (4) Json (1) Junit (1) kali (37) kernel (2) Kotlin (1) Laravel (2) Latin (1) LIbreOffice (1) Libros (4) Linux (44) Linux VirtualBox (1) Literatura (1) Manuales (42) mariaDB (1) Markdown (4) Marketing (1) Matando ladilla (9) Matematricas (1) Math (1) maven (1) metodos https (1) Modelos (1) MongoDB (17) Multimedia (1) Musica (1) mvc (2) Mysql (20) MySQL Workbench (1) Nagios (2) Naturismo (1) node (4) Node.js (5) NodeJS (8) NoSQL (1) Oracle (8) Oracle sql (8) Php (2) PL/SQL (1) Plsql (1) PNL (1) Poblacion (2) Podman (1) Poesia (1) Politica (4) Política (1) Postgresql (8) PowerShell (1) programacion (79) Psicologia (11) Python (5) Recomiendo (1) Redes (31) Religion (2) REST (2) Rock (1) Rock/Metal Mp3 (2) RUP (1) Salud (5) sc:snap:android-studio (1) sc:snap:datagrip (1) sc:snap:gitkraken linux (1) Seguridad (17) Seguridad con Gnu Privacy (2) Seo (1) simulaEntrevistas (10) simularExamen (10) Sistemas Operativos (69) SOAP (1) Sociedad (5) Software Libre (169) Soporte Tecnico (12) Sphinx (1) spring (1) spring boot (10) SQL (3) SQL en postgreSQL (38) Taekwondo (11) Tecnologia (5) Tecnología (27) Templarios (5) Tendencias (1) Thymeleaf (1) Tomcat (2) Tor (9) Trialectica (3) TYPEACRIPT (1) Ubuntu (5) unix (2) Vida activa (1) Videos (11) Videos Educativos (10) Vim (1) Viral (3) Visual Studio (1) wallpaper (2) web (1) Wifi (2) Windows (3) WWW (2) Xrandr (1) Zero Trust (2)

Sabiduria Justicia Templanza Coraje.

Hay que contemplar las potenciales consecuencias de nuestros planes, para impedir que nos sorprendan. De esta manera, tendremos más control sobre las situaciones difíciles.


Powered by