PDA

View Full Version : [SOLVED] [Python] Redirect output to browser



ryuguns
July 19th, 2011, 05:58 PM
How do you put the output from python into the browser instead of a terminal window?

I don't need anything graphical, text will do.

doas777
July 19th, 2011, 06:09 PM
well, it is my understanding that your execute your script via CGI within the context of the page, and use it to generate your return page.

look into this. shoudl give you the info you need.
http://docs.python.org/howto/webservers.html

juancarlospaco
July 19th, 2011, 07:06 PM
In real time? VERY complicated.

if not, just save it into an HTML file, and then open the file.

cgroza
July 19th, 2011, 07:08 PM
Do you want to create a web app? If so, you can use Bottle. It is fairly simple.

juancarlospaco
July 20th, 2011, 01:12 AM
Do you want to create a web app? If so, you can use Bottle. It is fairly simple.

+1


#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bottle import route, run
@route('/')
def index():
return 'Hola Mundo!'
run()