mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
Extending gunicorn timeout
This commit is contained in:
parent
d93c413983
commit
f900b5d4bf
2 changed files with 28 additions and 29 deletions
|
@ -4,26 +4,31 @@ import subprocess
|
|||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
if os.path.exists(
|
||||
os.path.join(
|
||||
app.config.get('ROOT_DIR', os.getcwd()), "config.local.py")):
|
||||
config = os.path.join(
|
||||
app.config.get('ROOT_DIR', os.getcwd()), "config.local.py")
|
||||
if os.path.exists(os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config.local.py")):
|
||||
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config.local.py")
|
||||
else:
|
||||
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config.py")
|
||||
app.config.from_pyfile(config)
|
||||
|
||||
timeout = config.TIMEOUT
|
||||
|
||||
|
||||
def start_websockify(websockify_path, target_file):
|
||||
result = subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE)
|
||||
if not result.stdout:
|
||||
subprocess.call([
|
||||
websockify_path, '8081', '--token-plugin', 'TokenFile',
|
||||
'--token-source', target_file, '-D'
|
||||
],
|
||||
stdout=subprocess.PIPE)
|
||||
subprocess.call(
|
||||
[
|
||||
websockify_path,
|
||||
'8081',
|
||||
'--token-plugin',
|
||||
'TokenFile',
|
||||
'--token-source',
|
||||
target_file,
|
||||
'-D',
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
|
||||
|
||||
def on_starting(server):
|
||||
start_websockify(app.config['WEBSOCKIFY_PATH'],
|
||||
app.config['WEBSOCKIFY_TARGET_FILE'])
|
||||
start_websockify(app.config['WEBSOCKIFY_PATH'], app.config['WEBSOCKIFY_TARGET_FILE'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue