Merge pull request #2541 from nsiregar/#2535_update_pycharm_instruction
Before adoption: this commit came in with the history the project adopted, so no landing records it.
update pycharm instructions
authored by David Lord · committed by GitHub · parents c2bac6d, c11fe5d · Browse files · 3 files·+39 added−29 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+39 added−29 removed
- other:+39 added−29 removed
Provenance
- Commit
54f3d21- Tree
72e4a0a- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
c2bac6d- Parent 2
c11fe5d
3 files changed+39 added−29 removed
modified:docs/_static/pycharm-runconfig.pngbinary
A binary file, modified.
modified:docs/cli.rst+37 added-27 removed
341 unmodified lines342 343 PyCharm Integration344 -------------------345 346-The new Flask CLI features aren't yet fully integrated into the PyCharm IDE,347-so we have to do a few tweaks to get them working smoothly. These instructions348-should be similar for any other IDE you might want to use.346+The Flask CLI features aren't yet fully integrated into the PyCharm IDE,347+so we have to do a few tweaks to get them working smoothly. These348+instructions should be similar for any other IDE you might want to use.349 350-In PyCharm, with your project open, click on *Run* from the menu bar and go to351-*Edit Configurations*. You'll be greeted by a screen similar to this:350+In PyCharm, with your project open, click on *Run* from the menu bar and351+go to *Edit Configurations*. You'll be greeted by a screen similar to352+this:353 354 .. image:: _static/pycharm-runconfig.png354- :align: center355- :class: screenshot356- :alt: screenshot of pycharm's run configuration settings355+ :align: center356+ :class: screenshot357+ :alt: screenshot of pycharm's run configuration settings358 358-There's quite a few options to change, but once we've done it for one command,359-we can easily copy the entire configuration and make a single tweak to give us360-access to other commands, including any custom ones you may implement yourself.359+There's quite a few options to change, but once we've done it for one360+command, we can easily copy the entire configuration and make a single361+tweak to give us access to other commands, including any custom ones you362+may implement yourself.363 362-For the *Script* input (**A**), navigate to your project's virtual environment.363-Within that folder, pick the ``flask`` executable which will reside in the364-``bin`` folder, or in the ``Scripts`` on Windows.364+Click the + (*Add New Configuration*) button and select *Python*. Give365+the configuration a good descriptive name such as "Run Flask Server".366+For the ``flask run`` command, check "Single instance only" since you367+can't run the server more than once at the same time.368 366-The *Script Parameter* field (**B**) is set to the CLI command you to execute.367-In this example we use ``run``, which will run the development server.369+Select *Module name* from the dropdown (**A**) then input ``flask``.370 369-You can skip this next step if you're using :ref:`dotenv`. We need to add an370-environment variable (**C**) to identify our application. Click on the browse371-button and add an entry with ``FLASK_APP`` on the left and the name of the372-Python file or package on the right (``app.py`` for example).371+The *Parameters* field (**B**) is set to the CLI command to execute372+(with any arguments). In this example we use ``run``, which will run373+the development server.374 374-Next we need to set the working directory (**D**) to be the same folder where375-our application file or package resides. PyCharm changed it to the directory376-with the ``flask`` executable when we selected it earlier, which is incorrect.375+You can skip this next step if you're using :ref:`dotenv`. We need to376+add an environment variable (**C**) to identify our application. Click377+on the browse button and add an entry with ``FLASK_APP`` on the left and378+the Python import or file on the right (``hello`` for example).379 378-Finally, untick the *PYTHONPATH* options (**E**) and give the configuration a379-good descriptive name, such as "Run Flask Server", and click *Apply*.380+Next we need to set the working directory (**D**) to be the folder where381+our application resides.382 383+If you have installed your project as a package in your virtualenv, you384+may untick the *PYTHONPATH* options (**E**). This will more accurately385+match how you deploy the app later.386+387+Click *Apply* to save the configuration, or *OK* to save and close the388+window. Select the configuration in the main PyCharm window and click389+the play button next to it to run the server.390+381-Now that we have a configuration which runs ``flask run`` from within PyCharm,382-we can simply copy that configuration and alter the *Script* argument391+Now that we have a configuration which runs ``flask run`` from within392+PyCharm, we can copy that configuration and alter the *Script* argument393 to run a different CLI command, e.g. ``flask shell``.modified:tox.ini+2 added-2 removed
38 unmodified lines39 coverage run -p -m pytest tests examples40 41 [testenv:docs-html]42 deps = sphinx43-commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html43+commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html44 45 [testenv:docs-linkcheck]46 deps = sphinx47-commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck47+commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs {envtmpdir}/linkcheck48 49 [testenv:coverage-report]50 deps = coverage51 skip_install = true13 unmodified lines