Browse Source

smaller, optimized image

reword / reformat the docs
fix tox build directory
pull/2541/head
David Lord 7 years ago
parent
commit
c11fe5d007
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. BIN
      docs/_static/pycharm-runconfig.png
  2. 63
      docs/cli.rst
  3. 4
      tox.ini

BIN
docs/_static/pycharm-runconfig.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 17 KiB

63
docs/cli.rst

@ -343,40 +343,51 @@ script is available. Note that you don't need to set ``FLASK_APP``. ::
PyCharm Integration PyCharm Integration
------------------- -------------------
The new Flask CLI features aren't yet fully integrated into the PyCharm IDE, The Flask CLI features aren't yet fully integrated into the PyCharm IDE,
so we have to do a few tweaks to get them working smoothly. These instructions so we have to do a few tweaks to get them working smoothly. These
should be similar for any other IDE you might want to use. instructions should be similar for any other IDE you might want to use.
In PyCharm, with your project open, click on *Run* from the menu bar and go to In PyCharm, with your project open, click on *Run* from the menu bar and
*Edit Configurations*. You'll be greeted by a screen similar to this: go to *Edit Configurations*. You'll be greeted by a screen similar to
this:
.. image:: _static/pycharm-runconfig.png .. image:: _static/pycharm-runconfig.png
:align: center :align: center
:class: screenshot :class: screenshot
:alt: screenshot of pycharm's run configuration settings :alt: screenshot of pycharm's run configuration settings
There's quite a few options to change, but once we've done it for one command, There's quite a few options to change, but once we've done it for one
we can easily copy the entire configuration and make a single tweak to give us command, we can easily copy the entire configuration and make a single
access to other commands, including any custom ones you may implement yourself. tweak to give us access to other commands, including any custom ones you
may implement yourself.
Since PyCharm 2017.3, you can run modules instead of needing to find ``flask`` Click the + (*Add New Configuration*) button and select *Python*. Give
executable. For the *Module name* input (**A**), you just need to input ``flask``. the configuration a good descriptive name such as "Run Flask Server".
For the ``flask run`` command, check "Single instance only" since you
can't run the server more than once at the same time.
The *Parameters* field (**B**) is set to the CLI command you to execute. Select *Module name* from the dropdown (**A**) then input ``flask``.
In this example we use ``run``, which will run the development server.
You can skip this next step if you're using :ref:`dotenv`. We need to add an The *Parameters* field (**B**) is set to the CLI command to execute
environment variable (**C**) to identify our application. Click on the browse (with any arguments). In this example we use ``run``, which will run
button and add an entry with ``FLASK_APP`` on the left and the name of the the development server.
Python file or package on the right (``app.py`` for example).
Next we need to set the working directory (**D**) to be the same folder where You can skip this next step if you're using :ref:`dotenv`. We need to
our application file or package resides. PyCharm changed it to the directory add an environment variable (**C**) to identify our application. Click
with the ``flask`` executable when we selected it earlier, which is incorrect. on the browse button and add an entry with ``FLASK_APP`` on the left and
the Python import or file on the right (``hello`` for example).
Finally, untick the *PYTHONPATH* options (**E**) and give the configuration a Next we need to set the working directory (**D**) to be the folder where
good descriptive name, such as "Run Flask Server", and click *Apply*. our application resides.
Now that we have a configuration which runs ``flask run`` from within PyCharm, If you have installed your project as a package in your virtualenv, you
we can simply copy that configuration and alter the *Script* argument may untick the *PYTHONPATH* options (**E**). This will more accurately
match how you deploy the app later.
Click *Apply* to save the configuration, or *OK* to save and close the
window. Select the configuration in the main PyCharm window and click
the play button next to it to run the server.
Now that we have a configuration which runs ``flask run`` from within
PyCharm, we can copy that configuration and alter the *Script* argument
to run a different CLI command, e.g. ``flask shell``. to run a different CLI command, e.g. ``flask shell``.

4
tox.ini

@ -40,11 +40,11 @@ commands =
[testenv:docs-html] [testenv:docs-html]
deps = sphinx deps = sphinx
commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html
[testenv:docs-linkcheck] [testenv:docs-linkcheck]
deps = sphinx deps = sphinx
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs {envtmpdir}/linkcheck
[testenv:coverage-report] [testenv:coverage-report]
deps = coverage deps = coverage

Loading…
Cancel
Save