superset/panoramix/bin/panoramix
Maxime Beauchemin ca3959783c New script
2015-09-09 22:21:38 -07:00

37 lines
982 B
Python
Executable File

#!/usr/bin/env python
from flask.ext.script import Manager
from panoramix import app, config
from subprocess import Popen
from flask.ext.migrate import MigrateCommand
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.option(
'-d', '--debug', action='store_true',
help="Start the web server in debug mode")
@manager.option(
'-p', '--port', default=config.PANORAMIX_WEBSERVER_PORT,
help="Specify the port on which to run the web server")
def runserver(debug, port):
"""Starts a Panoramix web server"""
debug = debug or config.DEBUG
if debug:
app.run(
host='0.0.0.0',
port=int(port),
debug=True)
else:
cmd = (
"gunicorn "
"-w 8 "
"-b 0.0.0.0:{port} "
"panoramix:app").format(**locals())
print("Starting server with command: " + cmd)
Popen(cmd, shell=True).wait()
if __name__ == "__main__":
manager.run()