Skip to content

Commit 4c08e3a

Browse files
committed
update pycharm instructions
1 parent 3e5ca29 commit 4c08e3a

File tree

3 files changed

+22
-39
lines changed

3 files changed

+22
-39
lines changed

docs/_static/pycharm-run-config.png

75.6 KB
Loading

docs/_static/pycharm-runconfig.png

-16.8 KB
Binary file not shown.

docs/cli.rst

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -552,53 +552,36 @@ script is available. Note that you don't need to set ``--app``. ::
552552
PyCharm Integration
553553
-------------------
554554

555-
PyCharm Professional provides a special Flask run configuration. For
556-
the Community Edition, we need to configure it to call the ``flask run``
557-
CLI command with the correct environment variables. These instructions
558-
should be similar for any other IDE you might want to use.
555+
PyCharm Professional provides a special Flask run configuration to run the development
556+
server. For the Community Edition, and for other commands besides ``run``, you need to
557+
create a custom run configuration. These instructions should be similar for any other
558+
IDE you use.
559559

560-
In PyCharm, with your project open, click on *Run* from the menu bar and
561-
go to *Edit Configurations*. You'll be greeted by a screen similar to
562-
this:
560+
In PyCharm, with your project open, click on *Run* from the menu bar and go to *Edit
561+
Configurations*. You'll see a screen similar to this:
563562

564-
.. image:: _static/pycharm-runconfig.png
563+
.. image:: _static/pycharm-run-config.png
565564
:align: center
566565
:class: screenshot
567-
:alt: Screenshot of PyCharms's run configuration settings.
566+
:alt: Screenshot of PyCharm run configuration.
568567

569-
There's quite a few options to change, but once we've done it for one
570-
command, we can easily copy the entire configuration and make a single
571-
tweak to give us access to other commands, including any custom ones you
572-
may implement yourself.
568+
Once you create a configuration for the ``flask run``, you can copy and change it to
569+
call any other command.
573570

574-
Click the + (*Add New Configuration*) button and select *Python*. Give
575-
the configuration a name such as "flask run". For the ``flask run``
576-
command, check "Single instance only" since you can't run the server
577-
more than once at the same time.
571+
Click the *+ (Add New Configuration)* button and select *Python*. Give the configuration
572+
a name such as "flask run".
578573

579-
Select *Module name* from the dropdown (**A**) then input ``flask``.
574+
Click the *Script path* dropdown and change it to *Module name*, then input ``flask``.
580575

581-
The *Parameters* field (**B**) is set to the CLI command to execute
582-
(with any arguments). In this example we use ``run``, which will run
583-
the development server.
576+
The *Parameters* field is set to the CLI command to execute along with any arguments.
577+
This example uses ``--app hello --debug run``, which will run the development server in
578+
debug mode. ``--app hello`` should be the import or file with your Flask app.
584579

585-
You can skip this next step if you're using :ref:`dotenv`. We need to
586-
add an environment variable (**C**) to identify our application. Click
587-
on the browse button and add an entry with ``FLASK_APP`` on the left and
588-
the Python import or file on the right (``hello`` for example). Add an
589-
entry with ``FLASK_ENV`` and set it to ``development``.
580+
If you installed your project as a package in your virtualenv, you may uncheck the
581+
*PYTHONPATH* options. This will more accurately match how you deploy later.
590582

591-
Next we need to set the working directory (**D**) to be the folder where
592-
our application resides.
583+
Click *OK* to save and close the configuration. Select the configuration in the main
584+
PyCharm window and click the play button next to it to run the server.
593585

594-
If you have installed your project as a package in your virtualenv, you
595-
may untick the *PYTHONPATH* options (**E**). This will more accurately
596-
match how you deploy the app later.
597-
598-
Click *Apply* to save the configuration, or *OK* to save and close the
599-
window. Select the configuration in the main PyCharm window and click
600-
the play button next to it to run the server.
601-
602-
Now that we have a configuration which runs ``flask run`` from within
603-
PyCharm, we can copy that configuration and alter the *Script* argument
604-
to run a different CLI command, e.g. ``flask shell``.
586+
Now that you have a configuration for ``flask run``, you can copy that configuration and
587+
change the *Parameters* argument to run a different CLI command.

0 commit comments

Comments
 (0)