0

Is there any way to serve a SSL site using the Python Flask (no apache/nginx frontend) framework with the two following caveats?

  1. Nothing additional can be compiled on the host (testing on a base Xubuntu 14.04 image, python 2.7.6 is the default interpreter).
  2. No privileges on the local host available, so no packages can be installed to the system

I am using VirtualEnv to set up the requirements and then running a standalone Flask application from within the VirtualEnv environment.

As best I can tell, this is not possible.

  1. This guy ran into the same problem (requires Python 2.7.9, which violates requirement 1 and, as best as I can tell, nothing has 2.7.9 installed by default): http://www.sadafnoor.com/blog/ssl-https-from-python-flask/
  2. This workaround requires pyOpenSSL to be installed which breaks because of a missing package: http://flask.pocoo.org/snippets/111/, resolution to install pyopenssl: https://askubuntu.com/questions/499714/error-installing-scrapy-in-virtualenv-using-pip

In summary, my goal is to serve a Python Flask site over HTTPS without requiring the installation or compilation of any other programs (self signed cert if desired). Installing via the VirtualEnv pip command is fine, but no host level packages via apt-get or the like.

I have tried several methods unsuccessfully (http://kracekumar.com/post/54437887454/ssl-for-flask-local-development and http://flask.pocoo.org/snippets/111/).

Am I missing something or am I just going to have to install a web server front end to handle SSL?

Thanks!

Community
  • 1
  • 1
you
  • 303
  • 2
  • 13
  • have you tried cherrypy? or perhaps docker with your limitations! I personally use nginx + uwsgi like described http://stackoverflow.com/a/27221427/567606 – tourdownunder Mar 03 '15 at 06:42
  • I have seen cherrypy mentioned but haven't looked at it hard. I will check tonight and let you know if that fits the bill. Thanks darwindave – you Mar 03 '15 at 17:47
  • @darwindave I looked at cherrypy and it looks like it would have the same issues as flask because the requirements were the same (pyopenssl was being used). thanks for the input. – you Mar 04 '15 at 04:33

1 Answers1

0

In the end, as best as I could tell, I have to install some things via apt-get to get this working on a default install of Xubuntu 14.04:

sudo apt-get install python-dev libssl-dev libffi-dev
you
  • 303
  • 2
  • 13