argparse
This commit is contained in:
parent
21dbce7488
commit
9f4d778eb2
1 changed files with 6 additions and 6 deletions
12
app/run.py
12
app/run.py
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
from clize import Clize, run
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_apscheduler import APScheduler
|
from flask_apscheduler import APScheduler
|
||||||
from conf import config
|
from conf import config
|
||||||
|
@ -26,9 +26,7 @@ class JobConfig(object):
|
||||||
|
|
||||||
JOBS = []
|
JOBS = []
|
||||||
|
|
||||||
SCHEDULER_EXECUTORS = {
|
SCHEDULER_EXECUTORS = {"default": {"type": "threadpool", "max_workers": 20}}
|
||||||
'default': {'type': 'threadpool', 'max_workers': 20}
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, mail_polling_seconds, new_comment_polling_seconds):
|
def __init__(self, mail_polling_seconds, new_comment_polling_seconds):
|
||||||
self.JOBS = [
|
self.JOBS = [
|
||||||
|
@ -47,7 +45,6 @@ class JobConfig(object):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@Clize
|
|
||||||
def stacosys_server(config_pathname):
|
def stacosys_server(config_pathname):
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
@ -97,4 +94,7 @@ def stacosys_server(config_pathname):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run(stacosys_server)
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("config", help="config path name")
|
||||||
|
args = parser.parse_args()
|
||||||
|
stacosys_server(args.config)
|
||||||
|
|
Loading…
Add table
Reference in a new issue