python脚本开发html_Python脚本中的动态HTML

I have a python script whose output i want to dynamically display

on a webpage which will be hosted using Apache. How do I do that?

thanks

解决方案asdf wrote:

I have a python script whose output i want to dynamically display

on a webpage which will be hosted using Apache. How do I do that?

thanks

Well, there''s a few ways you could approach it.

You could create a cgi program from your script - this is probably the

solution you''re looking for.

You could have the script run periodically and create a static html file

in the webroot... this would be acceptable, maybe preferable, if the

output from your script doesn''t change frequently.

There''s also more advanced ways you can make python code run in a

web-service. Cherrypy comes to mind, as well as the myriad python MVC

frameworks.

Well, there''s a few ways you could approach it.

>

You could create a cgi program from your script - this is probably the

solution you''re looking for.

Output from the script does come up very often. There is a new output

every 10 secs and it''s possible that the script might be run indefinitely.

Basically I want all that output displayed in a web browser

You could have the script run periodically and create a static html file

in the webroot... this would be acceptable, maybe preferable, if the

output from your script doesn''t change frequently.

asdf wrote:

>Well, there''s a few ways you could approach it.

You could create a cgi program from your script - this is probably the

solution you''re looking for.

Output from the script does come up very often. There is a new output

every 10 secs and it''s possible that the script might be run indefinitely.

Basically I want all that output displayed in a web browser

Well, in that case you could simply append the new output to a static

file every 10 seconds, or whenever there is new output. That way, you

just need to refresh the static file in your browser to see updates...

Given what I understand of your situation, that''s how I''d do it.

A constantly running CGI app is probably not the best idea, given

timeouts and other such constraints you might run into.

>You could have the script run periodically and create a static html file

in the webroot... this would be acceptable, maybe preferable, if the

output from your script doesn''t change frequently.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值