Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give pserve the ability top open server in browser #1533

Merged
merged 1 commit into from
Jan 21, 2015

Conversation

msabramo
Copy link
Contributor

E.g.:

pserve app.ini --browser

or:

pserve app.ini -b

Cc: @sontek, @mmerickel, @mcdonc

url = 'http://{host}:{port}/'.format(**context.config())
time.sleep(1)
webbrowser.open(url)
threading.Thread(target=open_browser).start()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we mark the thread as detached so that it doesn't block the process from terminating?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@msabramo msabramo force-pushed the pserve_webbrowser_open branch from 24f6288 to 5296842 Compare January 20, 2015 21:14
@mmerickel
Copy link
Member

I'm amazed to see that the run method has no cover on it. We need to fix that in the future. Anyway if you could add a changelog entry I'll merge this.

@mmerickel
Copy link
Member

I'm going back and forth on the cli option names -w and --webbrowser-open. Is there any other tool that provides similar options? I'd lean toward like --open-browser or -w myself.

@msabramo
Copy link
Contributor Author

$ gem server --help
...
    -l, --launch[=COMMAND]           launches a browser window
                                     COMMAND defaults to 'start' on Windows
                                     and 'open' on all other platforms

@msabramo
Copy link
Contributor Author

$ ipython notebook --help
...
--browser=<Unicode> (NotebookApp.browser)
    Default: u''
    Specify what command to use to invoke a web browser when opening the
    notebook. If not specified, the default browser will be determined by the
    `webbrowser` standard library module, which allows setting of the BROWSER
    environment variable to override it.
...

@msabramo
Copy link
Contributor Author

Maybe -b or --browser?

@mmerickel
Copy link
Member

Yeah I can't think of something that -b would clobber right now, so it's fine with me.

@msabramo msabramo force-pushed the pserve_webbrowser_open branch from 5296842 to 91fbe78 Compare January 20, 2015 21:56
E.g.:

    pserve app.ini --browser

or:

    pserve app.ini -b
@msabramo msabramo force-pushed the pserve_webbrowser_open branch from 91fbe78 to 8dd9708 Compare January 20, 2015 21:58
@msabramo
Copy link
Contributor Author

Cool, updated.

mmerickel added a commit that referenced this pull request Jan 21, 2015
Give pserve the ability top open server in browser
@mmerickel mmerickel merged commit 6c867a8 into Pylons:master Jan 21, 2015
@mmerickel
Copy link
Member

Awesome! Thanks!

@msabramo msabramo deleted the pserve_webbrowser_open branch January 21, 2015 00:39
@mmerickel mmerickel added this to the 1.6 milestone Feb 6, 2015
@marc1n
Copy link
Contributor

marc1n commented Jan 26, 2016

This change does not respect --server-name option. It only works when server name is 'main' (default).

@mmerickel
Copy link
Member

@marc1n Sure, if you would like to submit a PR fixing this it'd be accepted.

marc1n added a commit to marc1n/pyramid that referenced this pull request Jan 26, 2016
Fixing PR Pylons#1533: Setting pserve options --server-name SERVER-NAME and --browser, when SERVER-NAME is different than 'main' caused error : "LookupError: No section 'main' (prefixed by 'server') found in config ..."
marc1n added a commit to marc1n/pyramid that referenced this pull request Jan 26, 2016
Fixed PR Pylons#1533. Calling:
   pserve --server-name abc --browser app.ini
caused error : "LookupError: No section 'main' (prefixed by 'server') found in config app.ini"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants