Python3(.4) Https Server

Here is an example how to create a https server in python3.4. It assumes you have got a ssl certificate in ssl/localhost.pem and a html template under templates/index.html.

Furthermore it assumes you have created a virtual environment under ./env/ and installed jinja2 into it.

The server code:

Shell script to create the¬†certificate (self signed)… this is a variation of an elder post. Here it creates a certificate only (self) signed for localhost:

And if you like you can import the file ssl/localhost.crt as trusted server certificate into your browser. This will overcome the certificate warning.