Commit 798343dd authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[server] add "--dev" flag for not opening browser tab on start

parent a2e53996
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
"""Starts the BEAT editor """Starts the BEAT editor
Usage: %(prog)s [-v...] [--debug] [--prefix=<path>] [--cache=<path>] Usage: %(prog)s [-v...] [--debug] [--prefix=<path>] [--cache=<path>] [--dev]
%(prog)s --help %(prog)s --help
%(prog)s --version %(prog)s --version
...@@ -42,6 +42,8 @@ Options: ...@@ -42,6 +42,8 @@ Options:
it goes along. it goes along.
-d, --debug Use the debug version of the javascript source to -d, --debug Use the debug version of the javascript source to
launch the editor launch the editor
--dev Use the development version, which doesn't open a new
web browser tab.
-p, --prefix=<path> Overrides the prefix of your local data. If not set use -p, --prefix=<path> Overrides the prefix of your local data. If not set use
the value from your RC file the value from your RC file
[default: %(prefix)s] [default: %(prefix)s]
...@@ -120,14 +122,14 @@ def main(user_input=None): ...@@ -120,14 +122,14 @@ def main(user_input=None):
api.add_resource(Templates, '/templates', resource_class_kwargs={'config': config}) api.add_resource(Templates, '/templates', resource_class_kwargs={'config': config})
api.add_resource(Environments, '/environments') api.add_resource(Environments, '/environments')
for entity in VALID_ENTITIES: for entity in VALID_ENTITIES:
print(entity)
api.add_resource(gen_endpoint(entity), '/' + entity, api.add_resource(gen_endpoint(entity), '/' + entity,
resource_class_kwargs={'config': config}) resource_class_kwargs={'config': config})
# open the browser tab right before starting the server # open the browser tab right before starting the server
# the latency of opening the tab will keep us from getting 404s # the latency of opening the tab will keep us from getting 404s
import webbrowser if not args['--dev']:
webbrowser.open('http://localhost:5000/') import webbrowser
webbrowser.open('http://localhost:5000/')
app.run(debug=args['--debug']) app.run(debug=args['--debug'])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment