Displaying charts saved on EC2 server in web browser

Assuming we have apache server running, and chart that we want to display is /var/www/images/foo_chart.png,
we place display_chart.py python script in /var/www/cgi-bin.
The script is:

if __name__ == "__main__":
    print "Content-type: image/png\n"
    print file(r"/var/www/images/foo_chart.png", "r").read()

Now, in web browser we type


and the page with our chart should be pulled up.
Instructions to install and start apache server can be found here.
Note: to get apache server working you need to allow port 80 for HTTP. This is easily done through amazon web-services personal account page -> dashboard -> security groups.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s