embedding python in HTML

Steve Holden steve at holdenweb.com
Sat Feb 18 03:33:09 EST 2006


bruno at modulix wrote:
> John Salerno wrote:
> 
>>Rene Pijlman wrote:
>>
>>
>>>John Salerno:
>>>[Python alternative for PHP]
>>>
>>>
>>>>So to do this with Python, do I simply integrate it into the HTML as
>>>>above, with no extra steps? 
>>>
>>>
>>>You'd need something like the PHP engine, that understands Python rather
>>>than PHP.
>>
>>
>>My web server can run Python, fortunately. Now that they've turned it on
>>for me, I wanted to try it out, but I didn't know how to go about
>>writing a bit of code to stick into an HTML file.
> 
> 
> You've got to understand that Python is *not* a 'ServerPage' language
> (-> php, asp, jsp etc) in itself. Your server can now run python, fine,
> but *how* ? CGI ? FastCGI ? mod_python ? other ? (hint: it's probably
> just plain old CGI...)
> 
> 
It's not an Active Scripting language by default after installation of 
the win32all extensions, but it can be made one, giving it access to 
Request, Response and the other usual suspects in the ASP environment.

This wouldn't be my preferred way to use it, but (for example) it allows 
you to include Python sources in VBScript pages and have your VBScript 
code call Python functions and procedures. This alone is sometimes 
worthwhile.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list