Created
August 19, 2014 08:00
-
-
Save agalera/571630e36a6b6bb550b5 to your computer and use it in GitHub Desktop.
Example bottle and gunicorn + gevent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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