-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.py
34 lines (29 loc) · 890 Bytes
/
manage.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# created: zhangpeng <[email protected]>
import os
import echo
import logging
import tornado.web
from tornado.options import options
from torweb.application import make_application
from torweb.config import CONFIG
from torweb import run_torweb
#from tornado.options import define, options
from code import interact
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
settings_path = os.path.join(echo.base_path, "settings.yaml")
logging.info("^_^")
logging.info(settings_path)
CONF = CONFIG(settings_path)
debug = CONF("DEBUG_PAGE")
url_root = CONF("URL_ROOT")
#define("port", default=8888)
default_port = options.port
app = make_application(echo, debug, wsgi=True, settings_path=settings_path, url_root=url_root)
if options.cmd == "runserver":
run_torweb.run(app, port=default_port)
else:
run_torweb.show_urls(echo)