I just created a lightweight web.py web app that I was able to successfully host on an Amazon EC2 instance. I am able to serve the webpage just fine with the following command:
python bin/app.py &
I specifically added the ampersand at the end to ensure that the process continues in the background, and the web app is served even when I close the ssh connection to my EC2 instance. However, I notice that after a while, on trying to access the same page, I start to get some error messages. Could it be that somehow EC2 takes away the resources from my instance after a while, which could be causing this? Also is my approach to create a persistent web service on EC2 fine, or is there a better approach?
The error that I see is:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/wsgiserver/__init__.py", line 1245, in communicate
req.respond()
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/wsgiserver/__init__.py", line 775, in respond
self.server.gateway(self).respond()
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/wsgiserver/__init__.py", line 2018, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/httpserver.py", line 268, in __call__
return self.app(environ, xstart_response)
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/httpserver.py", line 236, in __call__
return self.app(environ, start_response)
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/application.py", line 287, in wsgi
start_resp(status, headers)
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/httpserver.py", line 265, in xstart_response
self.log(status, environ)
File "/usr/lib/python2.6/site-packages/lpthw.web-1.1-py2.6.egg/web/httpserver.py", line 281, in log
print >> outfile, utils.safestr(msg)
IOError: [Errno 5] Input/output error