forked from JoneXiong/YouMd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
38 lines (31 loc) · 1.3 KB
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# coding=utf-8
from optparse import OptionParser
from mole import run
from mole.mole import default_app
from mole.sessions import SessionMiddleware
version = '1.1.0'
import routes
app = SessionMiddleware(app=default_app(), cookie_key="457rxK3w54tkKiqkfqwfoiQS@kaJSFOo8h",no_datastore=True)
if __name__ == "__main__":
parser = OptionParser(usage="usage: python %prog [options] filename",
version="YouMd %s" % version)
parser.add_option("-p", "--port",
action="store",
type="int",
dest="port",
default=8081,
help="Listen Port. default=8081")
parser.add_option("-H", "--host",
action="store",
type="string",
dest="host",
default='0.0.0.0',
help="Server host address. default=0.0.0.0")
parser.add_option("-s", "--server",
action="store",
type="string",
dest="server",
default='wsgiref',
help="Type of server. default=wsgiref")
(options, args) = parser.parse_args()
run(app=app, host=options.host, port=options.port, server=options.server)