-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunserver.py
More file actions
32 lines (25 loc) · 794 Bytes
/
runserver.py
File metadata and controls
32 lines (25 loc) · 794 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
25
26
27
28
29
30
31
32
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from tornado.options import define, options
from torngas.webserver import Server
define("runmode", default='runserver', help='run mode, runserver|syncdb', type=str)
os.environ.setdefault('TORNGAS_APP_SETTINGS', 'settings.setting')
if __name__ == '__main__':
"""
If you want to quickly start the service , you can do like this:
from torngas.webserver import run
run()
"""
server = Server()
server.parse_command()
if options.runmode == 'syncdb':
from appstart.sync_db import syncdb
syncdb()
elif options.runmode == 'runserver':
server.load_urls()
server.load_application()
server.load_httpserver()
server.server_start()
else:
exit(0)