How do I setup Run/Debug Config to open browser automatically for Flask?

Hi,

I am testing the Flask micro framework right now and I can't figure out how to setup the run/debug configuration to automatically open the web browser with http://127.0.0.1:5000/ as the URL.

Namely, I see the "Run browser" options in the Django and Google App Engine configs, but I can't seem to find similar options for a Python file - as the configuration options appear to be different depending on my project type... ???

Right now I just do it manually, but it does get to be a bit repetitive. When I used to use Eclipse for development, similar options are available right out of the box for any languages - and if I require more complex configs, I can always use Ant as my last resort. Here the runtime config appears a bit limited. Perhaps there is something I am missing here?

Any suggestions would be very much appreciated.

Cheers,

See-ming

4 comments
Comment actions Permalink

Hello See-ming,

Indeed, the option to open the browser is only available for run configurations

which are known to run a Web server. We monitor the output of the server

process and launch the browser only when the server has completed initializing;

that monitoring logic is specific to each type of the server.

I am testing the http://flask.pocoo.org/ right now and I can't figure

out how to setup the run/debug configuration to automatically open the

web browser with http://127.0.0.1:5000/ as the URL.

Namely, I see the "Run browser" options in the Django and Google App

Engine configs, but I can't seem to find similar options for a Python

file - as the configuration options appear to be different depending

on my project type... ???

Right now I just do it manually, but it does get to be a bit

repetitive. When I used to use Eclipse for development, similar

options are available right out of the box for any languages - and if

I require more complex configs, I can always use Ant as my last

resort. Here the runtime config appears a bit limited. Perhaps there

is something I am missing here?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

As a last resort, you could configure an External Tool to launch a browser command.

These seem to be filed under "IDE Settings" not "Project Settings" though, which may or may not be suitable.

0
Comment actions Permalink

So, if I am to use the Flask framework - or any other web framework other than Django or Google App Engine for the matter - how would I set it up to run in PyCharm effectively? Can you illustrate the steps?

0
Comment actions Permalink

Thanks for your reply. I looked into the external tools section but I can't figure out how to utilize it in my run config. Specifically, I have no problems opening up the browser to run the URL - but is there a way to tie these two actions together:

  1. Run/Debug configuration
  2. Open External Tools

all in one go instead of two?

0

Please sign in to leave a comment.