i use chartdirector to make png image,so i want to use this png image
in my html file with web.py,my code are:
*********code.py**************
# coding:utf-8
import web
import simplebar
urls=(
'/char',simplebar.char,
'/','index'
)
app=web.application(urls,globals())
render = web.template.render('templates/', cache=False)
class index:
def GET(self):
# name = "Bob"
return render.index()
if __name__ == "__main__":
web.application(urls,globals()).run()
*******************index.html*************
IMG:
<img src="/char">
END
*********************simplebar.py***********
# coding:utf-8
import web
from pychartdir import *
urls = (
"",'makeChar'
)
class makeChar:
def GET(self):
data = [20,30,40,50]
labels = ['one','two','three','four']
c = XYChart(70,70)
c.setPlotArea(20,20,50,50)
c.addBarLayer(data)
c.xAxis().setLabels(labels)
# print "Content-type:image/png\n"
web.header("Content-type","image/png")
return binaryPrint(c.makeChart2(PNG))
char = web.application(urls,locals())
******************************************************
i use "python code.py 80" to start server,
but when i view http://127.0.0.1/,it don't show the png image,and the
server log show:
127.0.0.1:2243 - - [15/Jun/2009 23:37:26] "HTTP/1.1 GET /" - 200 OK
塒NG
? Da 渮俷P1??SmCRJ(Z鍍?鄎9K8蜯M潙潁 d䲡佅*|:^G槶鯝&7櫳鼝?嗭雄擃3?#?d苴兯}/m羍
c??c 鬬f?槞怖?焴 }F 梎R?c`4lh1,"`? $甦 2&唋da虐\ 5!" d s X0?D???? ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---