Skip to content

Instantly share code, notes, and snippets.

@agalera
Created August 19, 2014 08:00
Show Gist options
  • Save agalera/571630e36a6b6bb550b5 to your computer and use it in GitHub Desktop.
Save agalera/571630e36a6b6bb550b5 to your computer and use it in GitHub Desktop.
Example bottle and gunicorn + gevent
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from bottle import run, get
@get('/test')
def test():
return "test"
@get('/static/<path:path>') # prefer nginx
def static(path):
return static_file(path, root='./static')
if __name__ == "__main__":
if sys.argv[1] == "g":
print "gunicorn"
run(server='gunicorn', host='0.0.0.0', port=8099,workers=2, worker_class='gevent', debug=False, reloader=False)
else:
print "bottle normal"
run(host='0.0.0.0', port=8099, debug=True, reloader=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment