Skip to content
Myr

smaller, optimized image

Before adoption: this commit came in with the history the project adopted, so no landing records it.

reword / reformat the docs fix tox build directory

authored by David Lord · committed by David Lord · parent 5892a6f · Browse files · 3 files+39 added−28 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−28 removed

  • other:+39 added−28 removed

3 files+39 added−28 removed

modified:docs/_static/pycharm-runconfig.pngbinary

A binary file, modified.

modified:docs/cli.rst+37 added-26 removed
341 unmodified lines
342343PyCharm Integration344-------------------345346The new Flask CLI features aren't yet fully integrated into the PyCharm IDE,347so we have to do a few tweaks to get them working smoothly. These instructions348should be similar for any other IDE you might want to use.346The Flask CLI features aren't yet fully integrated into the PyCharm IDE,347so we have to do a few tweaks to get them working smoothly. These348instructions should be similar for any other IDE you might want to use.349350In 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:350In PyCharm, with your project open, click on *Run* from the menu bar and351go to *Edit Configurations*. You'll be greeted by a screen similar to352this:353354.. 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 settings358358There's quite a few options to change, but once we've done it for one command,359we can easily copy the entire configuration and make a single tweak to give us360access to other commands, including any custom ones you may implement yourself.359There's quite a few options to change, but once we've done it for one360command, we can easily copy the entire configuration and make a single361tweak to give us access to other commands, including any custom ones you362may implement yourself.363362Since PyCharm 2017.3, you can run modules instead of needing to find ``flask``363executable. For the *Module name* input (**A**), you just need to input ``flask``.364Click the + (*Add New Configuration*) button and select *Python*. Give365the configuration a good descriptive name such as "Run Flask Server".366For the ``flask run`` command, check "Single instance only" since you367can't run the server more than once at the same time.368365The *Parameters* field (**B**) is set to the CLI command you to execute.366In this example we use ``run``, which will run the development server.369Select *Module name* from the dropdown (**A**) then input ``flask``.370368You can skip this next step if you're using :ref:`dotenv`. We need to add an369environment variable (**C**) to identify our application. Click on the browse370button and add an entry with ``FLASK_APP`` on the left and the name of the371Python file or package on the right (``app.py`` for example).371The *Parameters* field (**B**) is set to the CLI command to execute372(with any arguments). In this example we use ``run``, which will run373the development server.374373Next we need to set the working directory (**D**) to be the same folder where374our application file or package resides. PyCharm changed it to the directory375with the ``flask`` executable when we selected it earlier, which is incorrect.375You can skip this next step if you're using :ref:`dotenv`. We need to376add an environment variable (**C**) to identify our application. Click377on the browse button and add an entry with ``FLASK_APP`` on the left and378the Python import or file on the right (``hello`` for example).379377Finally, untick the *PYTHONPATH* options (**E**) and give the configuration a378good descriptive name, such as "Run Flask Server", and click *Apply*.380Next we need to set the working directory (**D**) to be the folder where381our application resides.382383If you have installed your project as a package in your virtualenv, you384may untick the *PYTHONPATH* options (**E**). This will more accurately385match how you deploy the app later.386387Click *Apply* to save the configuration, or *OK* to save and close the388window. Select the configuration in the main PyCharm window and click389the play button next to it to run the server.390380Now that we have a configuration which runs ``flask run`` from within PyCharm,381we can simply copy that configuration and alter the *Script* argument391Now that we have a configuration which runs ``flask run`` from within392PyCharm, we can copy that configuration and alter the *Script* argument393to run a different CLI command, e.g. ``flask shell``.
modified:tox.ini+2 added-2 removed
38 unmodified lines
39 coverage run -p -m pytest tests examples4041[testenv:docs-html]42deps = sphinx43commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html43commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html4445[testenv:docs-linkcheck]46deps = sphinx47commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck47commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs {envtmpdir}/linkcheck4849[testenv:coverage-report]50deps = coverage51skip_install = true
15 unmodified lines