Skip to content

Commit

Permalink
Merge pull request #341 from willu47/issue-340
Browse files Browse the repository at this point in the history
Fixes issue #340 - adds port as a cli argument for app
  • Loading branch information
willu47 authored Apr 1, 2019
2 parents ba2627e + 146f423 commit 17aab98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/smif/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,13 @@ def _run_server(args):
data_interface=_get_store(args),
scheduler=ModelRunScheduler()
)
port = 5000

print(" Opening smif app\n")
print(" Copy/paste this URL into your web browser to connect:")
print(" http://localhost:" + str(port) + "\n")
print(" http://localhost:" + str(args.port) + "\n")
# add flush to ensure that text is printed before server thread starts
print(" Close your browser then type Control-C here to quit.", flush=True)
app.run(host='0.0.0.0', port=port, threaded=True)
app.run(host='0.0.0.0', port=args.port, threaded=True)


def run_app(args):
Expand Down Expand Up @@ -249,6 +248,10 @@ def parse_arguments():
parser_app = subparsers.add_parser(
'app', help='Open smif app', parents=[parent_parser])
parser_app.set_defaults(func=run_app)
parser_app.add_argument('-p', '--port',
type=int,
default=5000,
help="The port over which to serve the app")

# RUN
parser_run = subparsers.add_parser(
Expand Down

0 comments on commit 17aab98

Please sign in to comment.