forked from hagihala/gily
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
executable file
·24 lines (18 loc) · 766 Bytes
/
server.py
File metadata and controls
executable file
·24 lines (18 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from meinheld import server
from wsgi import application
from optparse import OptionParser
getopt = OptionParser()
getopt.add_option('-p', '--port', dest='port', type='int', default=5000, help='Listen Port')
getopt.add_option('-a', '--address', dest='address', type='string', default='0.0.0.0', help='Listen address')
getopt.add_option('-d', '--debug', dest='debug', action='store_true', default=False )
def main ():
opts, args = getopt.parse_args()
if opts.debug:
application.debug = True
print "Server listen: http://%s:%s/" % ( opts.address, opts.port )
server.listen( ( opts.address, opts.port ) )
server.run( application )
if __name__ == '__main__':
main()