Added new files
This commit is contained in:
commit
18a0d48c8c
31 changed files with 1956 additions and 0 deletions
31
citoplasma/gunicornssl.py
Normal file
31
citoplasma/gunicornssl.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
# This module is suitable for create ssl apis that don't need much performance, if you need more performance use nginx or apache proxiying for generate https content and Paramecio with gunicorn or others wsgi servers for generate the html/json content.
|
||||
|
||||
from bottle import ServerAdapter
|
||||
import ssl
|
||||
|
||||
class GunicornServerSSL(ServerAdapter):
|
||||
""" Untested. See http://gunicorn.org/configure.html for options. """
|
||||
|
||||
cert_pem=''
|
||||
privkey_pem=''
|
||||
workers=2
|
||||
|
||||
def run(self, handler):
|
||||
from gunicorn.app.base import Application
|
||||
|
||||
#'ciphers': 'TLSv1'
|
||||
#, 'ssl_version': ssl.PROTOCOL_TLSv1
|
||||
|
||||
config = {'bind': "%s:%d" % (self.host, int(self.port)), 'workers': self.workers, 'keyfile': self.privkey_pem, 'certfile': self.cert_pem, 'ssl_version': ssl.PROTOCOL_TLSv1}
|
||||
config.update(self.options)
|
||||
|
||||
class GunicornApplication(Application):
|
||||
def init(self, parser, opts, args):
|
||||
return config
|
||||
|
||||
def load(self):
|
||||
return handler
|
||||
|
||||
GunicornApplication().run()
|
||||
Loading…
Add table
Add a link
Reference in a new issue