Importar modulos Python con mod_python

Para importar un módulo que se encuentra en el mismo directorio del script (por ejemplo: /var/www/html/py) se debe incluir en el script principal:

Si el módulo tiene por nombre: “modulo_creado.py”.

directorio = os.path.dirname(__file__)
modulo_creado = apache.import_module("modulo_creado", path=[directorio])

Saludos!

Deje un comentario


NOTA - Puede usar estosHTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>