Added IP and port options
This commit is contained in:
parent
223ed1ae8e
commit
0bff151596
2 changed files with 7 additions and 4 deletions
|
|
@ -38,6 +38,10 @@ parser.add_argument('-d', '--debug', required=False, default=False, action='stor
|
|||
parser.add_argument('-l', '--logfile', required=False, default=False, action='store_true',
|
||||
help="""Enables logging to a file in the current working directory
|
||||
instead of stderr.""")
|
||||
parser.add_argument('-i', '--ip', required=False, default="0.0.0.0", type=str,
|
||||
help="""Specifies the IP to run the webapp at. Defaults to 0.0.0.0""")
|
||||
parser.add_argument('-p', '--port', required=False, default=8000, type=int,
|
||||
help="""Specifies the port to run the webapp at. Defaults to 8000""")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
|
|
@ -214,7 +218,7 @@ def main():
|
|||
|
||||
if args.command == 'webapp':
|
||||
from .web import start_web_app
|
||||
start_web_app()
|
||||
start_web_app(ip=args.ip, port=args.port)
|
||||
elif args.command == 'demo':
|
||||
demo()
|
||||
elif args.command == 'macro':
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import json
|
||||
import os
|
||||
from threading import RLock
|
||||
from time import perf_counter
|
||||
|
||||
from ..nxbt import Nxbt, PRO_CONTROLLER
|
||||
from flask import Flask, render_template, request
|
||||
|
|
@ -103,8 +102,8 @@ def handle_macro(message):
|
|||
nxbt.macro(index, macro)
|
||||
|
||||
|
||||
def start_web_app():
|
||||
eventlet.wsgi.server(eventlet.listen(('127.0.0.1', 8000)), app)
|
||||
def start_web_app(ip='0.0.0.0', port=8000):
|
||||
eventlet.wsgi.server(eventlet.listen((ip, port)), app)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue