title: Executing Python From HTML on Generic Web Platform
body: <p>So I recently discovered mod_python, which is great because its not hard to rewrite the PHP code I had and execute through Apache. However, I just found out that my hosting service, (HostGator), does not support this module because they have <a href="http://forums.hostgator.com/mod-python-support-t24894.html?s=b4af94800b6b7854758a90c799598c48&amp;" rel="nofollow">a single apache user instance per physical shared server</a>.</p>
  
  <p>This begs the question:</p>
  
  <p>Without the use of something like Django, Pylons, etc, is there a way to invoke python routines server side from HTML code and have it return web content?</p>
  
  <p>Example:</p>
  
  <p>Simple form</p>
  
  <pre><code>&lt;form name="message" action="directory/pythonscript.py/function" method="POST"&gt;
  </code></pre>
  
  <p>where, upon submission, the form parses the content in the form, and then the python routine returns a string of the newly assembled HTML file based on the input of the form, and the browser presumably re-renders it.</p>
  
  <pre><code>def function(args):
       #parse inputs
       #assemble html string
       return htmlString
  </code></pre>
  
  <p>Additional question:</p>
  
  <p>With mod_python, you must pass at least the "req" arg, which points to the apache request structure. Is this functionality still present without mod_python? Would I be able to somehow physically map to that without mod_python? </p>
  
  <p>I'm presuming that all of this is possible because <a href="http://support.hostgator.com/articles/hosting-guide/hardware-software/python-modules" rel="nofollow">HostGator does support python</a> and a lot of the modules, smtpd for example, have functionality to send emails, communicate over the web, etc, so presumably there is some way to access this API independent of Apache???</p>
  
  <p>99% of searches for this return info about Django, Pylons, etc. If that is indeed the best way to do it, I will explore that option, but all I want to do for now is create some dynamic HTML content with a back end python handler without having to install any other APIs.</p>
  
  <p>Thanks.</p>
  
  <p>EDIT</p>
  
  <p>I should clarify that I am not attached to mod_python at all, it is just something I found. My question is geared towards avoiding non-standard, (standard = shipped with Python 2.7.x, useable through apache or otherwise), APIs if possible.</p>