<br><br><div class="gmail_quote">On Fri, May 8, 2009 at 2:52 AM,  <span dir="ltr"><<a href="mailto:baseelinger@yahoo.com">baseelinger@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

So, my question is what is the best method to be able to have a user<br>
enter specific data on a web page, have that data be passed to the<br>
Python script and then have the output returned to the web page?<br>
Essentially, I want to use a web based front end to accomplish the<br>
same thing that the IDLE GUI does, (asks me a few questions, I answer<br>
them, it builds a configuration file and prints it to the screen).<br>
<font color="#888888"><br>
</font></blockquote></div><br>There isn't a best way, really.<br><br>I'm partial to CherryPy. A minimal example would look like so:<br><br>-------------------------------<br>import cherrypy<br><br>class Root(object):<br>
    page = "<html><head><title></title></head><body>%s</body></html>"<br>    @cherrypy.expose<br>    def enter_data(self, data):<br>        return self.page % ("You entered: " + data,)<br>
<br>    @cherrypy.expose<br>    def index(self):<br>        form = """<br>        <form id="aform" name="aform" action="enter_data" method="POST"><br>          <textarea name="data">Enter some stuff here</textarea><br>
          <input type="submit" value="Submit"/><br>        </form><br>        """<br>        return self.page % form<br><br>if __name__ == '__main__':<br>    cherrypy.quickstart(Root())<br>
<br>-----------------------------------<br><br>Note, I wouldn't actually recommend using string building like that for returning pages unless your app is seriously trivial. I use Genshi for templating, the tutorial that they have is very nice (and uses cherrypy).<br>
<br>There's a plethora of different ways to build web apps in python. In all reality, you should probably try out a few and see what suits your tastes.<br>