How to get waitress server working in an EC2 instance?
-
01-06-2021 - |
Question
I want to set up a partly developed website from an EC2 instance. The site is being developed using Pyramid web framework. Is it possible to set up simple waitress server from EC2?
I tried these instructions for setting up a Apache server. But when I point my browser to the public DNS, I get the error that says "website is taking too long to respond".
Solution
First of all, I'd recommend using mod_wsgi. I think it's the easiest to set up. Ignoring that, waitress is a WSGI server. It can run on port 80 directly if you want to.
[server:main]
use = egg:waitress
host = 0.0.0.0
port = 80
Unfortunately, if you do this, you need to be root. A better approach is to set the waitress server on an unprivileged port such as 8000 and use a reverse proxy to forward requests to your site.
Look at the deployment recipes in the pyramid cookbook here:
http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/index.html