14

Is it possible to run Pyramid's pserve such that it starts an https server (for example https://0.0.0.0:6543)?

I would like to gear up my application for https locally if possible.

Roman
  • 8,826
  • 10
  • 63
  • 103

2 Answers2

15

pserve uses waitress as it's server by default, however you can replace the server used by updating your .ini configuration file:

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 5900

For example:

[server:main]
use = egg:gunicorn
host = 0.0.0.0
port = 5900
workers = 1
worker_class = gevent

gunicorn has support for SSL out of the box from looking at the documentation, and you could add the following to enable SSL:

certfile=~/ssl/server.crt
keyfile=~/ssl/server.key
ssl_version=3

This should allow you to run pserve and have an SSL enabled server. In most cases if you are deploying your project you would want to use nginx to proxy requests to your backend server, and have nginx do the SSL termination.

X-Istence
  • 16,324
  • 6
  • 57
  • 74
4

I don't think you can do it with only pserve. If you really need HTTPS for developing, I would suggest you do as in production. For example, use nginx as a reverse proxy that would handle HTTPS and pass HTTP to your application.

Antoine Leclair
  • 17,540
  • 3
  • 26
  • 18