[mod_python] Installation problems

Gregory (Grisha) Trubetskoy grisha at modpython.org
Thu Mar 21 09:54:57 EST 2002


Just before sending headers, add a line like this:

        req.content_type = "text/plain"
        req.send_http_header()

and try the url which asks you what program to use, it might just work.
Apache sets different content-types based on your configuration, which can
vary, so sometimes you have to force it to text/plain or text/html.

Grisha


On Wed, 20 Mar 2002, Reginald Charney wrote:

> I am unable to get mod_python working on my system. I think I have followed everything needed and documented, but when I enter the following URLs, I get:
>
> /test/mptest.py  - I am asked what program to use to execute this file
> /test/mptest      - lists the ASCII source of the file
>
> The following is what I believe is the relevant information from my installation. Any help would be appreciated. TIA.
>
> Reg. Charney
>
> Partial contents of /etc/httpd/httpd.conf
> =========================================
>
>     #
>     # And for PHP 4.x, use:
>     #
>     <IfModule mod_php4.c>
>     AddType application/x-httpd-php .php
>     AddType application/x-httpd-php .php4
>     AddType application/x-httpd-php-source .phps
>     </IfModule>
>
>     #
>     # And for mod_python, use:
>     #
>     <IfModule mod_python.c>
>     AddType application/x-httpd-py .py
>     </IfModule>
> ...
> <Directory /usr/local/httpd/htdocs/test>
>     AddHandler python-program .py
>     PythonHandler mptest
>     PythonDebug On
> </Directory>
>
>
> Test file /test/mptest.py
> =========================
>
> from mod_python import apache
>
> def handler(req):
>         req.send_http_header()
>         req.write("hello world!")
>         return apache.OK
>
>
> Output from phpinfo()
> =====================
> System:		Linux x330-2 2.4.9 #3 SMP Wed Feb 13 15:02:07
> Server Root:	/usr/local/httpd
> Loaded Modules:	mod_userdir, mod_python, mod_php4, mod_perl, mod_setenvif, mod_unique_id, mod_usertrack, mod_headers, mod_expires, mod_cern_meta, mod_proxy, mod_digest, mod_auth_db, mod_auth_dbm, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_speling, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_referer, mod_log_agent, mod_log_config, mod_define, mod_env, mod_vhost_alias, mod_mmap_static, mod_so, http_core
>
> PYTHONPATH:	/usr/lib/python2.1:/usr/lib/python2.1/plat-linux2:/usr/lib/python2.1/lib-tk:/usr/lib/python2.1/lib-dynload:/usr/lib/python2.1/site-packages:/usr/lib/apache/lib/python/site-packages
>
> SERVER_SOFTWARE: Apache/1.3.20 (Linux/SuSE) mod_python/2.7.5 Python/2.1.1 PHP/4.0.6 mod_perl/1.26
>
> HTTP_ENV_VARS["PATH"]:	/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list