我正处于我的应用程序的某个阶段,我试图根据sqlalchemy数据库中的数据使用统计界面(图形,图表)。然而,我遇到了matplotlib,我试图与它相处,但仍未能实现它。我正在使用Mako模板。 我正在请求如何解决这个问题。谢谢 见sam view的代码。
@view_config(route_name="d", renderer="./templates/d.mako")
def d(request):
try:
rows = DBSession.query(Song.duration, Song.price).all()
duration,price = zip(*rows)
plt.plot(duration,price)
##show()
except DBAPIError:
return Response(conn_err_msg, content_type='text/plain', status_int=500)
return { 'project': 'beatstore'}